希望の出力:5より大きいすべての数値。
いくつかの試みの一つ:
for i in {1..10}; do if ["$i" > 5]; then echo $i; fi; done
ただし、出力は次のようになります。
-bash: [1: command not found
-bash: [2: command not found
-bash: [3: command not found
-bash: [4: command not found
-bash: [5: command not found
-bash: [6: command not found
-bash: [7: command not found
-bash: [8: command not found
-bash: [9: command not found
-bash: [10: command not found
なくなったものありますか?
ベストアンサー1
スペースと-gt
user1@machine:~/tmp$ for i in {1..10}; do if [ $i -gt 5 ]; then echo $i; fi; done
6
7
8
9
10