通过本文主要向大家介绍了perl执行shell时的pid,perl 执行shell,shell perl,perl mcpan e shell,shell perl python等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
一、system
perl也可以用system调用shell的命令,它和awk的system一样,返回值也是它调用的命令的退出状态.
[root@AX3sp2 ~]# perl aa.pl
-rwxr-xr-x 1 root root 126 12-16 15:12 wt.pl
-rwxr-xr-x 1 root root 126 12-16 15:12 wt.pl
0
2010年 12月 16日 星期四 15:58:34 CST
</div>
二、反引号
perl的system函数和awk的一样不能够返回命令的输出.
要得到命令的输出,就得使用和shell本身一样的命令: ` `
[root@AX3sp2 ~]# perl bb.pl
2010年 12月 16日 星期四 15:51:59 CST
this is test
</div>
三、exec
最后,perl还可以使用exec来调用shell的命令. exec和system差不多,不同之处在于,调用exec之后,perl马上就退出,而不会去继续执行剩下的代码
[root@AX3sp2 ~]# perl cc.pl
this is test</div>

