Register
It is currently Sat Jul 26, 2014 1:05 am

Path Problems


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Mon Jan 12, 2009 8:03 am   

Joined: Mon Jan 12, 2009 7:13 am
Posts: 2
Location: Univ. of Conn.
Hi All - I wrote a script that executes a simulation executable with an input file as the argument. The script looks like
Code:
#/bin/bash
nohup $1 $2 > $2.nohup &

where $1 is the executable that runs the simulation and $2 is the input file. Now what I use this for is I call the script from a RealBasic program so that I can run simulations from my own GUI. The problem I am having is that the bash script doesn't recognize paths that have spaces in them. For example, if I run the script with $2 set to "/Users/DanSandberg/Desktop/myfile.inp" it works just fine but "/Users/DanSandberg/Desktop/my\ file.inp" fails. The shell returns
Quote:
nohup: $2.nohup ambiguous


Top
 Profile WWW  
 PostPosted: Mon Jan 12, 2009 11:16 am   
Site Admin
User avatar

Joined: Sun May 15, 2005 9:36 pm
Posts: 662
Location: Des Moines, Iowa
Code:
#/bin/bash
nohup ${1} ${2} > ${2}.nohup &


Try that.


Top
 Profile WWW  
 PostPosted: Mon Jan 12, 2009 12:13 pm   

Joined: Mon Nov 17, 2008 7:25 am
Posts: 221
or try encasing them in quotation, you have a whitespace in your filename which could mess things up abit

Code:
#/bin/bash
nohup "$1" "$2" > "$2.nohup" &


Best regards
Fredrik Eriksson


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: No registered users and 4 guests


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