1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@localhost ~]# sh iptables_mail.sh 
iptables: No chain/target/match by that name
iptables: Bad policy name
iptables: Bad policy name
iptables: Bad policy name
: command not foundine 10:
'ptables v1.3.5: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.3.5: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
: command not foundine 15:
'ptables v1.3.5: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.3.5: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
: command not foundine 19:
'ptables v1.3.5: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.3.5: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.3.5: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
'ptables v1.3.5: Invalid target name `ACCEPT
Try `iptables -h' or 'iptables --help' for more information.
...

这种情况出现的原因是 iptables_mail.sh 文件格式是Windows格式,是因为文件末尾^M导致。
需要将文件格式转化为Unix格式即可。
可以使用Gvim等编辑器帮助转换。