[user@mymachine folder]$ echo `date --date=tomorrow +%Y%m%d`
20160802
[user@mymachine folder]$ echo `date -d=tomorrow +%Y%m%d`
date: invalid date `=tomorrow'
I'm using Centos 5 if that makes any difference.
[user@mymachine folder]$ echo `date --date=tomorrow +%Y%m%d`
20160802
[user@mymachine folder]$ echo `date -d=tomorrow +%Y%m%d`
date: invalid date `=tomorrow'
I'm using Centos 5 if that makes any difference.
The short options or unix style options are usually separated from its argument using a space, but space is not strictly required in some cases
For instance
echo `date -dtomorrow +%Y%m%d`
and
echo `date -d tomorrow +%Y%m%d`
would work just fine
However in case of,
echo date -d=tomorrow +%Y%m%d
=tomorrow
is considered the argument to d
but it doesn't make a valid date string
date --date=tomorrow +%Y%m%d
date -d tomorrow +%Y%m%d
– user4556274 Aug 01 '16 at 18:52echo \
date --date=tomorrow +%Y%m%d`` instead of justdate --date=tomorrow +%Y%m%d
? (2) If you have a reason to use command substitution, you might want to change\
…`` to$(…)
just for clarity — see this, this, and this. – G-Man Says 'Reinstate Monica' Aug 03 '16 at 22:11