Code: Select all
declare -a options
while read option; do
options+=( "$option" )
done < <(getopt --long no-strip::,no-self:: -- "$@")
declare -a self
eval set -- "${options[@]}"
Code: Select all
declare -a options
options="$(getopt --long no-strip::,no-self:: -- "$@")"
declare -a self
eval set -- "${options[@]}"
Some mysterious output:
Code: Select all
+++ getopt --long no-strip::,no-self:: -- libc6 /tmp/pkg/root/pkg_aliases
++ options+=("$option")
++ read option
++ declare -a self
++ eval set -- '-- '\''/tmp/pkg/root/pkg_aliases'\'''
Trying to work this issue out I created some test code that I typed direectly into a terminal:
Code: Select all
# unset options
# while read option; do options+=($option); done < <(getopt -s bash --long no-strip::,no-self:: -- '' 'libc6' '/tmp/pkg/root/pkg_aliases' 'libc7')
# bla="${options[@]}"
# echo $bla
-- 'libc6' '/tmp/pkg/root/pkg_aliases' 'libc7'