LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 01-20-2004, 03:54 PM   #1
Paasan
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:

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
 
Old 01-20-2004, 11:16 PM   #2
crabboy
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, 01:45 AM   #3
Paasan
LQ Newbie
 
Registered: Sep 2002
Location: Norway
Posts: 9

Original Poster
Rep: Reputation: 0
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
 
  


Reply



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 01:03 AM
Shell Script: Find "Word" Run "Command" granatica Linux - Software 5 07-25-2007 07:42 AM
How to write a bash script to replace all "KH" to "K" in file ABC??? cqmyg5 Slackware 4 07-24-2007 09:00 AM
bash Problem with "sed" command blubbfish Linux - Newbie 3 06-01-2004 10:14 AM
bash script problem with "else" evilchild Programming 9 11-16-2003 08:57 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:30 PM.

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