mission_name=mars-mission
rocket_status=$(rocket-status $mission_name)
echo "Status of launch: ${rocket_status}_state"
mission_name=$1
read mission_name
read -p "Enter mission name:" mission_name
expr $A + $B
expr $A - $B
expr $A / $B
expr $A \* $B
echo $(( A + B ))
echo $(( A - B ))
echo $(( A / B ))
echo $(( A * B ))
echo $(( ++A ))
echo $(( --A ))
echo $(( A++ ))
echo $(( A-- ))
mission_name=mars-mission
rocket_status=$(rocket-status $mission_name)
if [ $rocket_status = "failed" ]
then
rocket-debug $mission_name
elif [ $rocket_status = "failed" ]
then
echo "This is successful"
else
echo "The state is not failed or successed"
fi
for mission in $(cat mission-names.txt)
do
create-and-launch-rocket $mission
done
for mission in 1 2 3 4 5 6
do
create-and-launch-rocket mission-$mission
done
for mission in {1..100}
do
create-and-launch-rocket mission-$mission
done
while [ $rocket_status = "launching" ]
do
sleep 2
rocket_status=$(rocket-status $mission_name)
done
echo "1. shutdown"
echo "2. Restart"
echo "3. Exit Menu"
read -p "Enter your choice: " choice
case $choice in
1) shutdown now ;;
2) shutdown -r now ;;
3) break ;;
#) continue ;;
esac
[ "abc" = "abc" ]
[ "abc" != "abc" ]
[ 5 -eq 5 ]
- equal[ 5 -ne 5 ]
- not equal[ 6 -gt 5 ]
- greater than[ 5 -lt 6 ]
- less than[[ "abcd" = "*bc*" ]]
[[ "abc" = ab[cd] ]]
[[ "abc" > "bcd" ]]
[[ A -gt 4 && A -lt 10 ]]
[[ A -gt 4 || A -lt 10 ]]
[ -e <file> ]
- 파일 존재 여부[ -d <file-or-directory> ]
- 파일 또는 디렉토리 존재 여부[ -s <file> ]
- 파일 크기가 0보다 큰지 여부[ -x <file> ]
- 파일 실행 가능 여부[ -z <file> ]
- 빈 파일 체크#!/bin/bash
echo $?
function launch-rocket() {
mission_name=$1
mkdir $mission_name
rocket-add $mission_name
rocket-start-power $mission_name
rocket-internal-power $mission_name
rocket-start-sequence $mission_name
rocket-start-engine $mission_name
rocket-lift-off $mission_name
rocket_status=$(rocket-status $mission_name)
w
hile [ $rocket_status == "launching" ]
do
sleep 2
rocket_status=$(rocket-status $mission_name)
done
if [$rocket_status = "failed" ]
then
rocket-debug $mission_name
exit 1
fi
}
launch-rocket saturn-mission
LUNAR_STATUS_CODE=$?