I'm really pulling my hair out on this one. I just started with some bash scripting and I'm trying to create a simple script that uses some dialogs to give me a fast way to do a svn checkout. It's working fine untill i want to serve a radiolist with multiple options which are fetched when you enter your project for a checkout.
Here's the last part of the code where it fails:
if [ $MATCHFOUND = true ]; then
echo 'Exact match found do checkout'
else
if [ ${#repoar[@]} == 0 ]; then
whiptail --title "Error" \
--msgbox "No matches found for [$PROJECT]" 8 78
./dialog.sh
else
for ((i=0; i<${#repoar[@]}; i++))
do
RADIOLIST=$RADIOLIST" \"$i\" \"${repoar[$i]}\" \"OFF\""
done
let ARLENGTH=${#repoar[@]}
whiptail --radiolist "Projects found" 20 78 $ARLENGTH "$RADIOLIST"
fi
fi
Example for $RADIOLIST
"0" "test" "OFF" "1" " test 5" "OFF" "2" " test2" "OFF" "3" " test3" "OFF" "4" " test4" "OFF"
The Radiolist arguments do no seem to get escaped like they should when i add the variable as parameter arguments. When i copy past the example using the whiptail command it works fine.