This question already has an answer here:

If I execute touch $(date '+%F %T'), I expect one file whose filename comprises the date and time to be created; but instead two files are created: one whose name is the date, and the other whose name is the time:

$ touch $(date '+%F %T')
$ ls -1

Why is this, and how can I create a file named 2019-03-05 12:39:26 instead, without using an underscore instead of a space?

marked as duplicate by Stéphane Chazelas bash Mar 5 at 13:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • If you run date '+%F %T' you will see you have two strings. This is like calling touch 12:39:26 2019-03-05. – Freddy Mar 5 at 12:52

Use double quotes:

touch "$(date '+%F %T')"


Not the answer you're looking for? Browse other questions tagged or ask your own question.