if判斷
if command
then
commands
fi
if command
then
commands
else
commands
fi
if command1
then
commands
elif command2
then
more commands
fi
if [ condition ]
then
commands
fi
複合條件測試
[ condition1 ] && [ condition2 ]
[ condition1 ] || [ condition2 ]
case語句
case variable in
pattern1 | pattern2) commands1;;
pattern3) commands2;;
*) default commands;;
esac
for循環
for var in list
do
commands
done