What's New in GNU Bash 5?

Last Updated: 

The version 5 of GNU Bash has been released and packed with quite a few improvements and fixes.

  1. You can now skip the use of date '+%s' with the new EPOCHSECONDS variable which expand the time in seconds since the Unix epoch, and EPOCHREALTIME with microsecond granularity. See below examples.
  2. The wait builtin command can now wait for the last process substition and it also includes a -f option to wait for the specified job or process to terminates.
  3. New BASH_ARGV0 variable that expands to $0 and sets $0 on assignment.
  4. New localvar_inherit shopt option for local variables to inherits the value of a variable with the same name at the nearest preceding scope.
  5. Few improvement and fixes in associative arrays including assoc_expand_once shell option, subscripts with white spaces, etc.
  6. globasciiranges is now the default which solve the common mistake of [a-z] vs [A-Z] matching.
  7. Many improvement on the history builtin.
  8. 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_history shell option, for disabling at runtime whether history is sent to syslog.


$ date '+%s' # Before Bash version 5



👉 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?.

Related bash posts that you may like...
5 Simple Steps On How To Debug a Bash Shell Script
Learn how to quickly debug scripts in Bash with those 5 simple steps that use some of the Bash shell special properties.
A Complete Guide to the Bash Environment Variables
A complete guide on the Linux Bash environment variables with details on how to set, unset, and use the specials shell variables or define custom environment variables.
How To Make A Custom Bash Shell Prompt
Learn how to customize your shell prompt and the specificity of the Bash Prompt variables PROMPT_COMMAND, PROMPT_DIRTRIM, PS0, PS1, PS2, PS3, and PS4.
The Most Useful Bash Shortcuts That You Will Want To Use
A detailed review of the most useful Terminal and Bash shortcuts to improve your productivity when typing command-lines and how to customize the ones you don't like.