From: cgoesche Date: Sat, 23 Aug 2025 01:52:29 +0000 (-0400) Subject: getopt: clarify the use of '--long' instead of '--longoptions' in shell examples X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5d0e9b54c53190f7b1229c59d4a862075a4f69eb;p=thirdparty%2Futil-linux.git getopt: clarify the use of '--long' instead of '--longoptions' in shell examples Addresses: #2593 Signed-off-by: Christian Goeschel Ndjomouo --- diff --git a/misc-utils/getopt-example.bash b/misc-utils/getopt-example.bash index 0870882af..78757ef68 100644 --- a/misc-utils/getopt-example.bash +++ b/misc-utils/getopt-example.bash @@ -20,6 +20,9 @@ # Note that we use "$@" to let each command-line parameter expand to a # separate word. The quotes around "$@" are essential! # We need TEMP as the 'eval set --' would nuke the return value of getopt. +# +# Note: We can use '--long' instead of '--longoptions', because getopt(3) +# allows unique abbreviations of long option names. TEMP=$(getopt -o 'ab:c::' --long 'a-long,b-long:,c-long::' -n 'example.bash' -- "$@") if [ $? -ne 0 ]; then diff --git a/misc-utils/getopt-example.tcsh b/misc-utils/getopt-example.tcsh index 2b822943f..094efa46f 100644 --- a/misc-utils/getopt-example.tcsh +++ b/misc-utils/getopt-example.tcsh @@ -26,6 +26,9 @@ # as a list. The ':q` copies that list without doing any substitutions: # each element of argv becomes a separate argument for getopt. The braces # are needed because the result is also a list. +# +# Note: We can use '--long' instead of '--longoptions', because getopt(3) +# allows unique abbreviations of long option names. set temp=(`getopt -s tcsh -o ab:c:: --long a-long,b-long:,c-long:: -- $argv:q`) if ($? != 0) then echo "Terminating..." >/dev/stderr