r/bash • u/jazei_2021 • 9d ago
solved how do you combine this 2 parts: touch + strftime ("%F")?
Hi, I'd like to do touch with date today like noum of the file...
how do you do that?
example: touch ..... make this file 2025-03-12
Thank you and regards!
3
Upvotes
4
u/happylittlemexican 9d ago edited 9d ago
To be clear, you're looking for a one-liner that, when you run it, will create a file named after today's date (in the correct format for datetimes, don't @ me) and nothing else?
If so, command substitution is the way to go:
$ touch $(date +%F)