Score:0

Is this a bug in 'date' command version 8.28/8.30?

cn flag

When I want to display the date in format YYYY-MM-DD I use the command:

date +%Y%m%d

This worked for ages without a problem. Now in Unbuntu 20.04LTS with the date command version 8.30, it gives an error:

date: multiple output formats specified

However, if I do:

sudo date +%Y%m%d

then it works fine again. Weird that you have to have root privileges to read the date. But now the strange thing:

Even if I'm root then I also need to use sudo, otherwise, I get the same error. This seems very strange to me. Is there a special reason for this? Or is this a bug?

waltinator avatar
it flag
Use `type date` to see if `date` is an alias, or comes from a funny directory in `$PATH`
waltinator avatar
it flag
Try quoting the parameter: `date "+%Y%m%d"`
waltinator avatar
it flag
Check for funny characters in your commands. Prepend `echo ` and append `| od -bc` to your commands. Are there any non-ASCII (`man ascii`) characters in your `%` string? `date` seems to think you have 2 `%` strings, so I suspect a separator character.
Jacq avatar
cn flag
@waltinator Owww .. I feel super stupid now .. I made an alias myself: alias date='date -R' in .bash_aliases; gonna remove that right away! Thanks!
waltinator avatar
it flag
Please click the checkmark to "accept" my answer, if it helped you, and might help others.
waltinator avatar
it flag
Also `unalias date` in the shells that were started earlier.
Score:3
it flag

Use type date to see if date is an alias, or comes from a funny directory in $PATH.

It turned out that the user had aliased date to something suboptimal.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.