
現在,在您將其標記為重複之前,請先理解我確實搜尋過這個問題,並且我已經嘗試了所有解決方案但沒有效果。
我的腳本:
#!/bin/bash
echo "Enter the number 3"
read t1
if [$t1 -eq 3]; then
echo "it is 3"
elif [$t1 > 3]; then
echo "it is greater than 3"
fi
exit 0
我得到的錯誤是:
./g.sh: line 5: [3: command not found
./g.sh: line 7: [3: command not found
答案1
需要空間 if [ $t1 -eq 3 ]