cuonglm's answer solves the problem of creating a file with spaces in general, but the problem starts by using the default output from
If you ever want to use a date or date-time string as part of your file name you should always use the
--rfc-3339 option (if on a recent GNU system) or an appropriate format string. This will give you file names that are sortable in a logical way. The
--rfc-3339 option takes a parameter, use
date depending on the accuracy you want in the filename:
You can also get a specific string without any spaces and just the info that you need from
date +FORMAT (use
man date for details).
will give you a file with a name like
20141029-0944 with no spaces and give you the illusion that you don't need to quote. But you still do, as you'd still be invoking the split+glob operator which could still actually split if used in a context where
$IFS has been changed from the default.