Revision history for Getopt-Long-Bash
2.1.0 2026-11-26T09:29:55Z
- INCOMPATIBLE CHANGES in EXIT_ON_ERROR. Scripts which disable
EXIT_ON_ERROR to leave undefined options in the arguments, such
as the options of a subcommand, have to be updated: disable
PERMUTE instead, and give the global options before the
subcommand
- INCOMPATIBLE: with EXIT_ON_ERROR disabled, getoptlong parse
stops at the first error and returns 1, and leaves the
arguments as they are. An undefined option was left in the
arguments, and it went wrong in a cluster of short options:
"-w170" for an undefined -w gave the argument before it three
times
- INCOMPATIBLE: a long option without its argument and a
validation error also return 1 with EXIT_ON_ERROR disabled.
They exited the script regardless of EXIT_ON_ERROR
- With EXIT_ON_ERROR disabled, SILENT suppresses all the error
messages of parsing, not only those of getopts
- Nothing changes with EXIT_ON_ERROR enabled, the default
- New option type "*": the arguments up to "--" are collected into
an array as they are, as "--names a b --"
2.0.0 2026-11-23T11:38:05Z
- INCOMPATIBLE CHANGES in getoptlong callback. Scripts which
register a callback with fixed arguments, or two or more
callbacks in one call, have to be updated. The former gets an
error when the callback is registered:
- INCOMPATIBLE: fixed arguments of a callback are passed before
the option name and value, so that a common function can be
called from several options and behave differently by the
arguments: "getoptlong callback quiet set_level 0" calls
"set_level 0 quiet 1". They were passed between the option
name and the value
- INCOMPATIBLE: getoptlong callback registers one callback at a
time, and takes the arguments after the function as fixed
arguments, as the document says. They were taken as more pairs
of an option and a function. A fixed argument or a function
name with white space, such as "func arg" of 1.5.0, is an error
- getoptlong callback gives an error for an undefined option, and
takes an alias name as the option it stands for. They were
silently ignored
1.5.0 2026-11-23T01:29:03Z
- Security fix: the value given to an option with a regex
validation (=(...)) was evaluated by the shell, so a command
substitution in the value was executed, and such a value could
pass the validation. All the versions up to 1.4.0 are
affected. =i and =f are not (#5)
- The pattern of a regex validation is not evaluated by the shell
either: quotes and $ in the pattern are regex characters
- The return value of a callback function is ignored, as
documented. A callback returning non-zero made the script die
with "callback function ... is not defined"
- A callback registered with two or more additional arguments was
silently not registered
- getoptlong command shows the library version with --version
- getoptlong with no subcommand gives a proper error under set -u,
and the default usage line works with a script path containing
spaces
1.4.0 2026-11-22T16:12:28Z
- Backslashes in the value of a list (@) or hash (%) option are
kept as is. They were taken as escapes and removed (#4)
1.3.0 2026-11-17T01:41:41Z
- An option which takes an optional argument (?) can have an
initial value, which was an error. It is the default: the
variable has it when the option is not specified, and --no-
unsets the variable
1.2.0 2026-11-16T09:05:11Z
- --no- with an option which takes an optional argument (?) unsets
the variable, as when the option is not specified. It gave the
empty string, the same as the option without a value. A value
assigned to the variable before the options are parsed works as
a default, which --no- removes. A callback of such an option
has to use ${var-} under set -u
1.1.1 2026-11-10T10:47:07Z
- Pass-through keeps a value as one element: it was split at
spaces and expanded as a file name pattern
- Pass-through passes the value of an optional argument, in the
form of "--option=value": it was dropped
1.1.0 2026-10-27T09:18:40Z
- Auto-initialize only when getoptlong.sh is sourced as a file, so
that the code embedded in a script does not take the script's
first argument for an options array, and document how to embed it
- Source the library with "-" in the multi-step examples
1.0.0 2026-08-27T14:22:49Z
- Require bash 4.4 or later, and report the required version when
running on an older bash
0.8.1 2026-03-30T17:04:10Z
- Document negative alias feature and getoptlong version subcommand
0.8.0 2026-03-09T07:53:38Z
- Add negative alias (~) for option negation (short and long)
- Show deny aliases with ~/~~ prefix in help output
0.7.2 2026-02-11T09:40:06Z
- Fix numeric comparison bug in permute loop (string > vs -gt)
- Add permute mode tests
0.7.1 2026-01-17T02:19:55Z
- Fix callback function naming for hyphenated options (list-themes calls list_themes)
0.7.0 2025-12-30T12:52:21Z
- Fix passthru negation with short option aliases (--no-v was becoming -v)
0.6.0 2025-12-24T07:22:23Z
- Allow whitespace around mark character keys for alignment
- Improve documentation with clearer examples
- Update Tutorial with spaced option definition format
0.5.0 2025-12-23T12:10:40Z
- Initial CPAN release
- Bash library for Getopt::Long-like option parsing
Keyboard Shortcuts
Global
s
Focus search bar
?
Bring up this help dialog
GitHub
gp
Go to pull requests
gi
Go to GitHub issues (only if GitHub is preferred repository)