小编rag*_*ghu的帖子

我们可以在 perl 脚本中获取 shell 脚本吗

我们可以在 perl 脚本中获取 shell 脚本吗?

示例: 方案 1:

cat test1.sh
#!/bin/ksh
DATE=/bin/date
Run Code Online (Sandbox Code Playgroud)

方案2:

cat test2.sh
#!/bin/ksh
. ./test1.sh  
echo `$DATE`
Run Code Online (Sandbox Code Playgroud)

方案3:

cat test3.pl
#!/usr/bin/perl
### here I need to source the test1.sh script
print `$DATE`'
Run Code Online (Sandbox Code Playgroud)

如何在 perl 中获取 shell 以便在执行 test3.pl 时打印日期

谢谢拉古

perl

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

perl ×1