【问题标题】:Unix shell, executing a command on a file based on dateUnix shell,根据日期对文件执行命令
【发布时间】:2017-11-23 23:33:27
【问题描述】:

我有一个应用程序服务器,它生成以下格式的每日日志:

access_log.{Y-m-d}

所以我想以这样的方式执行命令:

tail -f access_log.{+%Y-%m-%d}

有没有办法在不创建变量的情况下单行执行?

【问题讨论】:

标签: linux sh


【解决方案1】:

找到here

tail -f "access_log.$(date '+%Y-%m-%d')"

【讨论】:

    猜你喜欢
    • 2021-10-30
    • 2011-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多