bash builtin printf date format problem

Chris Elvidge celvidge@outlook.com
Mon Apr 1 15:28:28 GMT 2024


Using bash builtin printf '%(fmt)T', when fmt contains %-d (or %_d), 
there is no output - should print daynumber with no preceding 0 (or with 
preceding space). Similarly %-e. date +"%B %-d" works OK.

$ uname -a
CYGWIN_NT-10.0-19045 ASUS-X550C-WIN 3.5.1-1.x86_64 2024-02-27 11:54 UTC 
x86_64 Cygwin
$ bash --version
GNU bash, version 5.2.21(1)-release (x86_64-pc-cygwin)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[0] ASUS-X550C-WIN!celvi:(pty0):Mon 01 Apr 2024 04:14 pm BST:/home/celvi
$ printf '%(%B %d)T\n'
April 01
[0] ASUS-X550C-WIN!celvi:(pty0):Mon 01 Apr 2024 04:15 pm BST:/home/celvi
$ printf '%(%B %-d)T\n'

[0] ASUS-X550C-WIN!celvi:(pty0):Mon 01 Apr 2024 04:15 pm BST:/home/celvi
$ printf '%(%B %_d)T\n'

[0] ASUS-X550C-WIN!celvi:(pty0):Mon 01 Apr 2024 04:19 pm BST:/home/celvi
$ printf '%(%B %e)T\n'
April  1
[0] ASUS-X550C-WIN!celvi:(pty0):Mon 01 Apr 2024 04:19 pm BST:/home/celvi
$ printf '%(%B %-e)T\n'

[0] ASUS-X550C-WIN!celvi:(pty0):Mon 01 Apr 2024 04:19 pm BST:/home/celvi

Works properly on Slackware current and LMDE6. Anyone any ideas?


Thanks




-- 

Chris Elvidge


More information about the Cygwin mailing list