![小錯誤,但似乎很煩](https://rvso.com/image/88792/%E5%B0%8F%E9%8C%AF%E8%AA%A4%EF%BC%8C%E4%BD%86%E4%BC%BC%E4%B9%8E%E5%BE%88%E7%85%A9.png)
答案1
看起來您正在使用 的單大括號實現test
,但缺少所需的空格。你可能有類似的東西
echo "Is it morning? Please answer yes or no"
read var
if ["$var" == "yes"]; then
something
else
something else
fi
問題是大括號內需要空格,因此:
if [ "$var" == "yes" ]; then
有關語法的更多詳細信息,請閱讀test
with 命令的手冊頁man test
。