以下是什么表现?
#! /usr/bin/perl -w eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; #$running_under_some_shell
> if 0永远不会为真,因此eval部分永远不会执行,
>并且eval也很奇怪 – 在这种情况下$0的值是什么(单引号内?)
Ps:取自find2perl命令的结果
解决方法
最好的猜测 – 就像在这个评论#$running_under_some_shell中一样,它是检测脚本是否由perl之外的某个shell运行,例如庆典.
the if 0 is never true,so the eval part will never executed,
不是perl,不是.通过其他shell如bash,它不会发现行继续,只会执行eval语句.然后在perl下重新运行脚本. (奇怪的是有不同于hashbang线的选项.)
and the eval is strange too – what is the value of $0 in this context (inside single quotes?)
同样,这将通过bash而不是perl扩展:这里它表示find2perl传递给perl解释器的路径.