當在debian bash命令行中運行for語句時,它工作正常。 但是當我在sh腳本中運行它或使用bash命令運行它時,它會保持報告「在意外標記附近發生錯誤」do「 差異在哪裏?bash循環工作在命令行中,但在腳本中失敗
[[email protected]] ~/tmp $ for i in {1..10}; do echo $i; done
1
2
3
4
5
6
7
8
9
10
[[email protected]] ~/tmp $ bash for i in {1..10}; do echo $i; done
-bash: syntax error near unexpected token `do'
順便說一句,所有在centos環境中工作正常。