From the bug-bash@gnu.org announcement "Bash-5.3-beta available":
q. GLOBSORT: new variable to specify how to sort the results of
pathname expansion (name, size, blocks, mtime, atime, ctime,
none) in ascending or descending order.
w. BASH_MONOSECONDS: new dynamic variable that returns the value of
the system's monotonic clock, if one is available.
x. BASH_TRAPSIG: new variable, set to the numeric signal number of
the trap being executed while it's running.
https://lists.gnu.org/archive/html/bug-bash/2024-12/msg00120.html
A portable version of OpenBSD's ksh is distributed with the executable
name oksh [1]. It's a descendant of pdksh and can be shellchecked as
ksh.
[1]: https://github.com/ibara/oksh
The shflags command-line flags library creates variables at runtime
with a few well-defined functions. This causes shellcheck to spit out
lots of warnings about unassigned variables, as well as miss warnings
about unused flag variables.
We can address this with two parts:
1. Pretend that the shflags global variables are predefined like other
shell variables so that shellcheck doesn't expect users to set them.
2. Treat DEFINE_string, DEFINE_int, etc. as new commands that create
variables, similar to the existing read, local, mapfile, etc.
Part 1 can theoretically be addresssed without this by following sourced
files, but that doesn't help if people are otherwise not following
external sources.
The new behavior is on by default, similar to automatic bats test
behavior.
Addresses #1597
Always using braces makes it harder to accidentally change a variable by
pasting other text next to it, but the warning is off by default because
it's definitely a style preference. Omit special and positional
variables from the check because appending additional characters to them
already doesn't change parsing.
This is motivated by the fact that the popularity of bats is increasing
since the creation of bats-core/bats-core.
The code is a cherry-pick of koalaman/shellcheck/bats branch.
Fixkoalaman/shellcheck#417.