我们是否可以在perl脚本中调用shell脚本?
示例:
cat test1.sh
#!/bin/ksh
DATE=/bin/date
程序2:
cat test2.sh
#!/bin/ksh
. ./test1.sh
echo `$DATE`
程序3:
cat test3.pl
#!/usr/bin/perl
### here I need to source the test1.sh script
print `$DATE`'
如何在perl中调用shell以便在执行test3.pl时打印日期
谢谢 raghu
localtime
函数会产生一个几乎相同的字符串:perl -le 'print scalar localtime'
,你只需要获取时区,它们就会完全一致。 - Chas. Owens