相关疑难解决方法(0)

在Perl脚本中使用Bash环境变量?

我试图从我的Perl程序中运行Bash命令.但是Perl似乎把我的Bash $ PWD环境变量混淆为Perl变量.

我怎么能把它作为一个字符串全部读出来?

这就是我想要运行的

my $path = /first/path;
`ln -s $path $PWD/second/path`
Run Code Online (Sandbox Code Playgroud)

那些反引号在Bash中运行第二行.使用System()会产生同样的问题.

有任何想法吗?

linux bash perl pwd

3
推荐指数
1
解决办法
610
查看次数

如何使用find和Perl列出文件?

我在基于HP-UX的计算机上工作,我需要按日期列出文件夹中包含的日志名称,并将名称分隔为";" 和结果,按日期降序排序,存储在txt中,因此txt的内容如下:

2019-02-02;/home/user/Documents/imthelog03.log
2019-02-01;/home/user/Documents/imthelog02.log
2019-01-29;/home/user/Documents/imthelog01.log
Run Code Online (Sandbox Code Playgroud)

我试过这个:

find /home/user/Documents/*.log* exec perl -MPOSIX -e 'print POSIX::strftime "%Y%m%d\n", localtime((stat $ARGV[0])[9])'
Run Code Online (Sandbox Code Playgroud)

但是我无法得到我需要的东西,我不能使用stats 我使用a for逐行读取所以我如何得到日期并用txt中的a path/filename分隔;,按日期降序使用bash并最终perl , 谢谢!

bash perl file directory-listing

3
推荐指数
1
解决办法
75
查看次数

标签 统计

bash ×2

perl ×2

directory-listing ×1

file ×1

linux ×1

pwd ×1