📄 code7.txt
字号:
Chapter 7
------------------------------
if Statement with One Criteria
------------------------------
if [ $Quantity -eq 100 ]
then
echo "The box is full."
fi
------------------------------
if Statement with Two Criteria
------------------------------
if [ $Quantity -eq 100 ] && [ $AvailableBoxes -lt 1 ]
then
echo "The box is full and you have no more boxes."
fi
-----------------
if else Statement
-----------------
if [ $Quantity -eq 100 ]
then
echo "The box is full."
else
echo "The box is not full."
fi
if [ $Quantity -ne 100 ]
then
echo "The box is full."
echo "Sorry, you need to stop."
else
echo "The box is not full."
echo "Keep going!"
fi
-----------------
if elif Statement
-----------------
if [ $Quantity -eq 100 ]
then
echo "The box is full."
elif [ $Quantity -eq 95 ]
then
echo "You can add 5 cookies to the box."
fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -