简体   繁体   中英

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')"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM