💻 Geeky Vibes! Check out our partner WrinkledT: Sustainable Style With a POP 💥 🌈 for the Soul (and the Planet!) 🌎💚
The version 5 of GNU Bash has been released and packed with quite a few improvements and fixes.
- You can now skip the use of
date '+%s'with the newEPOCHSECONDSvariable which expand the time in seconds since the Unix epoch, andEPOCHREALTIMEwith microsecond granularity. See below examples. - The
waitbuiltin command can now wait for the last process substition and it also includes a-foption to wait for the specified job or process to terminates. - New
BASH_ARGV0variable that expands to $0 and sets $0 on assignment. - New
localvar_inheritshopt option for local variables to inherits the value of a variable with the same name at the nearest preceding scope. - Few improvement and fixes in
associative arrays including
assoc_expand_onceshell option, subscripts with white spaces, etc. globasciirangesis now the default which solve the common mistake of [a-z] vs [A-Z] matching.- Many improvement on the
historybuiltin. - Many regressions/bug fixes since version 4 which address some potential out-of-bounds memory errors, changes in the expansion of
$@and$*to conform to Posix standards.
👉 For the full list of changes, check the official announcement.
⚠️ Most Linux distributions don’t seem to come compiled with the new feature,
syslog_historyshell option, for disabling at runtime whether history is sent to syslog.
Examples: $EPOCHSECONDS and $EPOCHREALTIME
$ date '+%s' # Before Bash version 5
1547092066
$ echo $EPOCHSECONDS
1547092066
$ echo $EPOCHREALTIME
1547092066.749218
👉 To read more on how to manipulate and format dates in bash see the post How To Format Date and Time in Linux, macOS, and Bash?.
💻 Geeky Vibes! Check out our partner WrinkledT: Sustainable Style With a POP 💥 🌈 for the Soul (and the Planet!) 🌎💚





