utility

getopt (util-linux)

External enhanced getopt supports short and long option normalization. --test returns 4 in enhanced util-linux; shell-quoted output is not an argument array. Use explicit parsing to avoid evaluating generated shell text.

Formal Syntax & Structure

bash syntaxbash
getopt --test

Return Value

exit status

External enhanced getopt supports short and long option normalization. --test returns 4 in enhanced util-linux; shell-quoted output is not an argument array. Use explicit parsing to avoid evaluating generated shell text.

Working Example

Example Snippetbash
printf 'builtin: 'type -t getoptsprintf 'external: 'type -t getoptgetopt --teststatus=$?printf 'enhanced test status=%s\n' "$status"
Bash Reference