fixed array.

Choosing what containers to update was broken due to array mistakenly was a list.
Now fixed and should work fine, no matter what order specified eg. `5,1,2,7`
This commit is contained in:
mag37
2023-01-28 13:48:17 +01:00
committed by GitHub
parent 07edbac00b
commit 4d14244133

View File

@@ -99,19 +99,18 @@ done
} }
choosecontainers() { choosecontainers() {
while [[ "$ChoiceClean" =~ [A-Za-z] || -z "$ChoiceClean" ]]; do while [[ "$ChoiceClean" =~ [A-Za-z] || -z "$ChoiceClean" ]]; do
printf "What containers do you like to update? \n" printf "What containers do you like to update? \n"
options options
read -p 'Enter number(s) separated by ,(comma) : ' Choice read -p 'Enter number(s) separated by , : ' Choice
if [ "$Choice" == "0" ] ; then if [ "$Choice" == "0" ] ; then
SelectedUpdates=( ${NumberedUpdates[@]:1} ) SelectedUpdates=( ${NumberedUpdates[@]:1} )
ChoiceClean=$(echo $Choice|sed 's/[,.:;]/ /g') ChoiceClean=$(echo $Choice|sed 's/[,.:;]/ /g')
else else
ChoiceClean=$(echo $Choice|sed 's/[,.:;]/ /g') ChoiceClean=$(echo $Choice|sed 's/[,.:;]/ /g')
SelectedUpdates=$(\ for s in $ChoiceClean; do
for s in $ChoiceClean; do SelectedUpdates+=( ${NumberedUpdates[$s]} )
printf "%s\n" "${NumberedUpdates[${s}]}" done
done)
fi fi
done done
printf "\nYou've SelectedUpdates:\n" printf "\nYou've SelectedUpdates:\n"
@@ -141,4 +140,5 @@ if [ -n "$GotUpdates" ] ; then
else else
printf "\nNo updates available, exiting.\n" printf "\nNo updates available, exiting.\n"
fi fi
exit 0 exit 0