LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-21-2011, 03:48 PM   #1
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 165

Rep: Reputation: 3
XMESSAGE -- Possible to Change Return Codes??


Hey All,

So I'm writing a little shell script and in it I'm using "xmessage" to get back input from the user.

The user will get a msg box that could have 3 or 4 different messages in the msg box depending on the situation.
And I am using a "case" statement to handle the return codes from xmessage's 3 or 4 different buttons that it could have.

Depending upon the situation it could show either 3 or 4 buttons.
I would like to only keep one case statement to handle the return codes because it could get pretty cumbersome to have 4 different case statements, one for each msg box.

So my question is: Would it be possible to define what the return codes would be for each button manually???
(by default if you have 4 buttons the return codes would be (from button 1 to 4) 101,102,103,104)
Code:
For Example:
                 ##################################################
                 #              MSG BOX 1                         #
                 #     .           .           .           .      #
     Buttons --> # |Button 1|  |Button 2|  |Button 3|  |Button 4| #
Return Codes --> #    101         102         103         104     #
                 ##################################################



                 ##############################################
                 #             MSG BOX 2                      #
                 #     .           .           .              #
     Buttons --> # |Button 1|  |Button 2|  |Button 3|         #
Return Codes --> #    101         102         104             #
                 ##############################################
Thanks in Advance,
Matt
 
Old 07-21-2011, 08:28 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
Did you not notice the phrase "by default"? Perhaps you should read the man page a bit more carefully.
Quote:
-buttons button,button,...
This option will cause xmessage to create one button for each comma-separated button argument. The corresponding resource is buttons. Each button consists of a label optionally followed by a colon and an exit value.
Code:
xmessage -buttons foo:105,bar:106,baz:107 message
 
Old 07-22-2011, 08:12 AM   #3
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 165

Original Poster
Rep: Reputation: 3
David,

Hey David, thanks for the reply.

Haha yea, I guess I must have overlooked that. I did read through the man page but I guess I just didn't see that.
Well anyway, thanks for your help. Much appreciated.


Thanks,
Matt
 
  


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
Cron Return Codes SBN Linux - General 1 06-25-2011 09:04 PM
Need the return codes of the child processes gururaj Linux - Software 1 04-25-2006 04:26 PM
perl ignore return codes twistedpair Programming 5 02-14-2006 04:54 PM
mprotect() return codes tim_l Programming 2 05-09-2005 07:38 AM
return codes in c exvor Programming 4 01-21-2005 08:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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