我想取消注释 etter.conf 文件中的第 168 行。该命令在终端中运行正常,但在 perl 中尝试时出现错误。
system ("sed -i '168s/.*/redir_command_on = "iptables -t nat -A PREROUTING -i %iface -p tcp --dport %port -j REDIRECT --to-port %rport"/' /etc/etter.conf");
错误是:
Bareword found where operator expected at ./attack.pl line 135, near
""sed -i '168s'/.*'/redir_command_on = "iptables"
我认为这与特殊字符和转义有关。