开发者

GZip most recent file

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜