[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Output from date command defaults to 12-hour in Buster.



Hi,

29 avr. 2020 à 16:29 de wooledg@eeg.ccf.org:

> It breaks if you try to use your own "plus" argument.
>
> unicorn:~$ alias date='date +"%a %b %d %T %Z %Y"'
> unicorn:~$ date +%s
> date: extra operand ‘+%s’
> Try 'date --help' for more information.
> unicorn:~$ unalias date
> unicorn:~$ date +%s
> 1588170499
>
> If you mean "It worked when I ran date with no arguments", then sure,
> it will "work" for that one sample case.  But it breaks in many other
> cases.
>
Maybe you will find more appropriate use cases but for this one, there is a simple workaround:

$ date +"%a %b %d %T %Z %Y" 
Wed Apr 29 18:02:14 CEST 2020
$ date +"%s"
1588176139
$ alias date='date +"%a %b %d %T %Z %Y"'
$ date
Wed Apr 29 18:02:32 CEST 2020
$ \date +"%s"
1588176170

Best regards,
l0f4r0


Reply to: