cp foo.txt {,.backup.`date`}
This expands to something like cp foo.txt .backup.Thu Oct 17 01:02:03 GMT 2013. The space before the braces starts a new word.
cp foo.txt {,.backup. $((date)) }
The braces are in separate words, so they are interpreted literally. Furthermore, $((…)) is the syntax for arithmetic expansion; the output of date is nothing like an arithmetic expression. Command substitution uses a single set of parentheses: $(date).
cp foo.txt foo.backup.`date`
Closer. You could have expressed this with braces as cp foo.{txt,.backup.`date`}. There is still the problem that the output of date contains spaces, so it needs to be put inside double quotes. This would work:
cp foo.{txt,backup."`date`"}
or
cp foo.{txt,backup."$(date)"}
The default output format of date is not well-suited to a file name, and it might even not work if a locale uses / characters in the default output format. Use a Y-M-D date format so that the lexicographic order on file names is the chronological order (and also to avoid ambiguity between US and international date formats).
cp foo.{txt,backup."$(date +%Y%m%d-%H%M%S)"}
touch foo\date +%F`` also works fine. – Vadzim Dec 23 '14 at 14:28cshshell – Govinda Sakhare Jan 24 '19 at 08:47...) instead of$(..). C shells apparently don't support that notation for subshells. – slm Jan 24 '19 at 13:28date +"%Y-%m-%d"is the same asdate -I. I wold recomment the iso formats anyway. The precision can be specified by adding hours, minutes, seconds, or ns to the parameter-I. Exampledate -Iseconds. – Till Schäfer Oct 24 '19 at 15:43