Hello,
I have some problems in using quotes:
I want to use the dialog command in a script so that the user can select some options.
This works fine
Code:
index=0
str=""
valarray_tag=(1 2 3)
valarray_desc=('This_is_option_1' 'This_is_option_2' 'This_is_option_3')
for item in ${valarray_tag[@]}; do
str=$str$item" "${valarray_desc[$index]}" "
index=$((index+1))
done
str=${str%' '}
dialog --menu "Test" 0 0 30 $str 2>/tmp/$$.dialog
But if I have descriptions with spaces I get in trouble!
Code:
index=0
str=""
valarray_tag=(1 2 3)
valarray_desc=('This is option 1' 'This is option 2' 'This is option 3')
for item in ${valarray_tag[@]}; do
str=$str$item" "${valarray_desc[$index]}" "
index=$((index+1))
done
str=${str%' '}
dialog --menu "Test" 0 0 30 $str 2>/tmp/$$.dialog
By directly typing I can quote the string but how is this done in my for loop? I have tried
Code:
str=$str$item" '"${valarray_desc[$index]}"' "
but then the ' get \' and this is not what I wanted!
Any ideas?
Thanks
RGummi