LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bash Script: Problem running variable command containing "" (https://www.linuxquestions.org/questions/programming-9/bash-script-problem-running-variable-command-containing-136822/)

Paasan 01-20-2004 03:54 PM

Bash Script: Problem running variable command containing ""
 
I need to run the following command inside a bash script:

Code:

dialog --backtitle "Back Title" --title "Title" --menu "" 40 40 10 \
"1" "one two three four" \
"2" "five six seven eight" \
2> temp.file

Where "1" "one two three four" "2" "five six seven eight" are diffrent variables. And it can be a lot more variables, since its going to be read from a seperate file which contains more or less rules for iptables

But when i run it it will be ran as:
Code:

dialog --backtitle "Back Title" --title "Title" --menu "" 40 40 10 \
"1" "one" \
"two" "three" \
"four" "2" \
"five" "six" \
"seven" "eight" \
2> temp.file

I've tryed everything possible i could think of like:
Code:

var1="1"
var2="one two three four"

Code:

var="$var $var1 $var2"
or

Code:

var="$var \"${var1}\" \"${var2}\""
or

Code:

var=$(echo $var \"$var1\" \"$var2\")
and a lot more.

This is a little hard to explain, but you can download the script from http://62.73.217.42/paasan.tar.gz
It will extract itself to a directory called "paasan" containing the script and a modified version of dialog.

Really hope someone can help
Thanks in advance :)

crabboy 01-20-2004 11:16 PM

Ok, I've downloaded the script, but I still do not understand what the problem is. It looks like the command generated is exactly as you posted it in the first code block. Post an example of what you are seeing and what you'd expect to see.

Paasan 01-21-2004 01:45 AM

This is what it looks like:
http://62.73.217.42/2.jpg

This is what i want it to look like:
http://62.73.217.42/1.jpg


All times are GMT -5. The time now is 03:50 PM.