在perl中執行shell命令

 在perl的模塊庫中有一個Shell.pm可以很方便地執行shell命令.

use Shell qw(cat ps cp);
$passwd = cat('</etc/passwd');
@pslines = ps('-ww'),
cp("/etc/passwd", "/tmp/passwd");

#面向對象方式
my $sh = Shell->new;
print $sh->ls('-l');

參考 http://search.cpan.org/~ferreira/Shell-0.72/Shell.pm

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章