Register
It is currently Wed Apr 16, 2014 4:38 am

Launch compiler in new window and pause to read message


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Tue Aug 18, 2009 10:45 am   

Joined: Tue Aug 18, 2009 10:17 am
Posts: 2
Okay, I've been doing some text adventure game stuff on my eeepc (running eeexubuntu,) and I can't quite get my custom 'makeit' script to work the way I want it to. Desired requirements:
- I want to be able to double-click on the script from Thunar and have it spawn a new term window
- Whether the compiler succeeds or fails, I want the window to stay open until I do something to dismiss it, like hit ENTER, so I can see the messages that it outputs.

I've had some luck with the following code:
#!/bin/bash
xterm -e '/usr/bin/inform hunter.inf hunter.z -SX +include_path=/home/chrisk/infocom/hunter,/home/chrisk/infocom/Zcode,/home/chrisk/infocom/Contrib && read'

The xterm call handles spawning the new window, and the 'read' command, if it gets called, will pause nicely. However, because of the way the && operator works, if the inform call fails, read isn't called. (If I subsituted || for &&, I know I could get it to pause only on a failure, and that's slightly better, but not good enough.)

Other things I've tried:
Substituting variants on { /usr/bin/inform hunter.inf hunter.z -SX +include_path=/home/chrisk/infocom/hunter,/home/chrisk/infocom/Zcode,/home/chrisk/infocom/Contrib ; read ; } for the && notation. Based on an example I saw, this is supposed to do sequence instead of short-circuit conditionals, but I keep getting 'unrecognized token at }' or something like that.
Building one bash script with the inform call and read on seperate lines, and a second script calling xterm -e 'firstscript' The xterm window always closes immediately

The machine has GNU bash, version 3.2.39(1) release (i486-pc-linux-gnu)
Should I be upgrading it?


Top
 Profile  
 PostPosted: Tue Aug 18, 2009 11:00 am   

Joined: Tue Aug 18, 2009 10:17 am
Posts: 2
Whoohoo, I just got it working, with the two scripts approach.

Had to make the second one:
xterm -e '/home/chrisk/infocom/hunter/firstscript'

:) I'd still appreciate any suggestions for other ways to get the same job done.


Top
 Profile  
 PostPosted: Tue Sep 01, 2009 5:41 pm   
User avatar

Joined: Sat Jun 13, 2009 8:53 pm
Posts: 73
Location: Texas!
Would it work if you just replaced the && with a ';' ?

Code:
#!/bin/bash
xterm -e '/usr/bin/inform hunter.inf hunter.z -SX +include_path=/home/chrisk/infocom/hunter,/home/chrisk/infocom/Zcode,/home/chrisk/infocom/Contrib ; read'


Other than that, it looks good!


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: DarthWavy and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP