Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-20-2004, 04:54 PM   #1
LQ Newbie
Registered: Sep 2002
Location: Norway
Posts: 9

Rep: Reputation: 0
Bash Script: Problem running variable command containing ""

I need to run the following command inside a bash script:

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:
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:
var2="one two three four"
var="$var $var1 $var2"

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

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

This is a little hard to explain, but you can download the script from
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
Old 01-21-2004, 12:16 AM   #2
Senior Member
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
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.
Old 01-21-2004, 02:45 AM   #3
LQ Newbie
Registered: Sep 2002
Location: Norway
Posts: 9

Original Poster
Rep: Reputation: 0
This is what it looks like:

This is what i want it to look like:


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 02:03 AM
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 08:42 AM
How to write a bash script to replace all "KH" to "K" in file ABC??? cqmyg5 Slackware 4 07-24-2007 10:00 AM
bash Problem with "sed" command blubbfish Linux - Newbie 3 06-01-2004 11:14 AM
bash script problem with "else" evilchild Programming 9 11-16-2003 09:57 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:00 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration