[英]Unix shell, executing a command on a file based on date
I have an application server that produces daily log on the following format: 我有一台应用服务器,它每天都会生成以下格式的日志:
access_log.{Y-m-d}
So I want to execute a command in a way like this: 所以我想以这样的方式执行命令:
tail -f access_log.{+%Y-%m-%d}
Is there any way to do a in single line without creating variables ? 有什么办法可以在不创建变量的情况下在一行中完成?
在这里找到
tail -f "access_log.$(date '+%Y-%m-%d')"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.