
これを重複として報告する前に、私がこの問題を検索し、すでにすべての解決策を試したが効果がなかったことを理解してください。
私のスクリプト:
#!/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 ]