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-22-2009, 10:44 AM   #1
Jude Terror
LQ Newbie
 
Registered: Dec 2008
Posts: 27

Rep: Reputation: 0
Is it possible to use variables to define Xdialog parameters in Bash script?


I want to use variables to define the <max> and <def> parameters in an Xdialog spinbox. The code I am trying is:
Code:
Xdialog --2spinsbox 'Change the horizontal (x) and vertical (y) start point for your cropbox:' 0 60 \
1 $owcur $xcur 'x' \
1 $ohcur $ycur 'y' 2> $temppath/xytemp.tmp
The 1 $owcur $xcur 'x' should define the <min>, <max>, <def>, <label> parameters for the first item in the spinbox, but I am getting an error:
bad range parameters. Is it impossible to use variables in this way with Xdialog, or am I overlooking something stupid?
 
Old 01-22-2009, 12:04 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
You didn't say what possible values the variables might have, so I had to experiment a a bit (I had no idea what a --2spinsbox was until I tried it out). Your command works just fine for me as long as I ensure that $xcur is smaller than $owcur, because the def needs to fall within the min-max range. Anything outside of that throws the error you're getting.
 
Old 01-22-2009, 01:10 PM   #3
Jude Terror
LQ Newbie
 
Registered: Dec 2008
Posts: 27

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by David the H. View Post
You didn't say what possible values the variables might have, so I had to experiment a a bit (I had no idea what a --2spinsbox was until I tried it out). Your command works just fine for me as long as I ensure that $xcur is smaller than $owcur, because the def needs to fall within the min-max range. Anything outside of that throws the error you're getting.
Thanks! I just figured this out myself a few minutes ago - it was a bad line in an awk script that was creating the variables.
 
  


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 - parsing optional parameters yitzle Programming 5 02-17-2008 11:16 AM
set variables in a bash script; ansi PS1 color script donnied Programming 4 11-21-2007 11:33 AM
Passing parameters to bash script Kamikazee Programming 4 10-01-2005 06:41 AM
bash script ? -- spaces in passed parameters azwr Linux - Newbie 3 06-18-2004 06:57 PM
Passing Parameters to Bash Script mooreted Linux - Software 3 04-05-2004 09:08 PM

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

All times are GMT -5. The time now is 05:15 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