【发布时间】:2011-10-10 16:14:49
【问题描述】:
我遇到了以下示例。我试图谷歌但找不到太多,所以我在这里发布这个问题。
- 这样执行 perl 脚本有什么好处?
- 在执行完 perl 代码后,如何让 shell 脚本像“正常”的 shell 脚本一样工作?
代码如下:
#!/bin/ksh
#! -*- perl -*-
eval 'exec $PERLLOCATION/bin/perl -x $0 ${1+"$@"} ;'
if 0;
print "hello world\n";
# how can I make it behave like a "normal" shell script from this point onwards? What needs to be done?
# echo "hello world" ### this results in error
【问题讨论】:
-
请参阅stackoverflow.com/a/25167736/411282,了解可以完成此操作的各种方法。