lrwxrwxrwx 1 root root 4 Dec 6 16:29 sh -> dash
dash使用for(( i=0;i<10;i++> ))這種用法會出現
Syntax error: Bad for loop variable
解決方法是:
- 使用bash來跑script
bash a.sh - 修改~/.bashrc加入
alias sh='bash'
ps. 使用dash的原因
sudo dpkg-reconfigure dash
The default /bin/sh shell on Debian and Debian-based systems is bash.
However, since the default shell is required to be POSIX-compliant, any shell that conforms to POSIX, such as dash, can serve as /bin/sh.
You may wish to do this because dash is faster and smaller than bash.
沒有留言:
張貼留言