开发者

GZip most recent file

开发者 https://www.devze.com 2023-03-11 18:35 出处:网络
I know that the best way to find the most recent file is through an operation like: ls -l -rt | tail -1

I know that the best way to find the most recent file is through an operation like:

ls -l -rt | tail -1

But I'm wanting to gzip this (most recent) file, because the 开发者_运维知识库program I'm writing will be putting a file in the current directory via a constructed command line argument in an outside interface. The user of the program shouldn't be aware of any background processes.

Thanks!


Try with another pipe :

cat `ls -rt | tail -1` | gzip > file.gz
0

精彩评论

暂无评论...
验证码 换一张
取 消