所需的输出:所有大于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
什么不见了?
空间和 -gt
user1@machine:~/tmp$ for i in {1..10}; do if [ $i -gt 5 ]; then echo $i; fi; done
6
7
8
9
10
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句