Ubuntu 下执行 shell 时出现下面的错误:
./iptables.sh: 14: Syntax error: Bad for loop variable
G 发现是解释器的原因,Ubuntu 默认将 sh 链接至 dash:
[email protected]:~$ ll /bin/sh
lrwxrwxrwx 1 root root 4 2011-08-25 19:49 /bin/sh -> dash*
将 sh 改为 bash 是一种方法,网上还有说像下面这样的,我没有验证:
$ sudo dpkg-reconfigure dash
选择 no