I am trying to create a directory with a timestamp. If I type at the prompt
mkdir "$(date +%Y-%m-%d_%H%M%S)"
I get a directory named with the date as I would like. If I put the same line in a bash script I get some strange characters at the end of the name. What is going on? I am attempting this in Cygwin and tried bash
and sh
.
$PATH
and/or shell builtins/functions/aliases. Verify thatcommand -V date
andENV=/dev/fd/0 sh <<< 'command -V date'
produce the same output. – mikeserv Jul 17 '14 at 21:01+...
bit like"$(date '+%Y-%m-%d_%H%M%S')"
- though I'm not certain off the top of my head why that would behave differently in a script than at the prompt. – mikeserv Jul 17 '14 at 21:08LC_TIME
– tijagi Jul 18 '14 at 0:37