bash hell , removing " and adding from a strings

I'm writing a bash script and i'm stuck

the out put of a dialog menu is

echo $select
"foo" "bar" "lemon" cheese"

while I need
$foo $bar $lemon $cheese

to reuse them as strings later in the script
and very new to bash scripting and i've no idea how to do this
any help would be fantastic

<code>
dialog --backtitle "Enable / Disable Tags" \
--no-cancel --title "CHECKLIST BOX" \
--checklist "Hi, blah blah fill me in" 25 61 15 \
"$CITY" "$CITY_TAG" off \
"$COPYRIGHT" "$COPYRIGHT_TAG" off \
"$Orange" "$orange_tag" off \
"$Chicken" "$chicken_tag" off \
"$Cat" "$CAT_TAG" off\
"$Fish" "$FISH_TAG" off \
"$Lemon" "$LEMON_TAG" on 2> $tempfile2

retval=$?

enable=\`cat $tempfile2\`

echo $enable
</code>
"foo" "bar" "lemon" "poo-sticks"

I'm not sure that I understand correctly what you're asking, but I think you are assigning a value that start with $ to a variable and want that value output. You will need to escape the character as \$value.

Here is an example:

foo=a
bar=b
dog=c

orange=\$foo
chicken=\$bar
cat=\$dog

echo "--------------"
enable="$orange $chicken $cat"
echo $enable

echo "--------------"
deref="$orange $chicken $cat"
eval echo $deref

echo "--------------"
alist="foo bar dog"
for var in $alist
do
    eval echo \$$var
    eval echo \$var
done

echo "--------------"
blist="orange chicken cat"
for var in $blist
do
    eval echo \$$var
    eval echo \$var
done

One other thing I am showing here is how to dereference a variable reference with eval.

$ ./mytest.sh 
--------------
$foo $bar $dog
--------------
a b c
--------------
a
foo
b
bar
c
dog
--------------
$foo
orange
$bar
chicken
$dog
cat

I hope this gives you an idea to solve your question.

-B

i used that and and it still made no sense

but it all became clear after a good nights sleep
but thanks for the tips :smiley: