New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

.command [Where am i?]


Post Reply New Thread Subscribe

 
Thread Tools
jago svensson
Guest
 
Posts: n/a

Hi.
My first Thread here.

Have a question about running .command files from the finder.

When i exec them their workingfolder is always my home directory.

I have a script that should execute a binary in the scriptfolder, witch is not a static path(on a removable media).

how can i get the script to understand that it should start the binnary in the folder given, and not in my home folder.?

Hope to finde some answers here.
/thanx in advance.
//Jago Svensson
QUOTE Thanks
karudzo

 
Member Since: May 27, 2006
Location: Concord, NC
Posts: 445
karudzo has a spectacular aura about
Mac Specs: Macbook Pro 17" 2.6GHz 4GB RAM

karudzo is offline
simply change the place in the script that reads:

~/whatever or /Users/yourusername/whatever

to a simple command.

For example if I had a script that said:
cp -R ~/example/ ~/backup/

it would back up the example directory in my home folder into a backup directory in my home directory. However if the script said:
cp -R example/ backup/

it would back up the example directory in the current directory into a backup directory in the current directory.

Hope that makes sense.
QUOTE Thanks
jago svensson
Guest
 
Posts: n/a

Hi.
Thanx, but this is exactly what im doing, if I run the script from the terminal
./script, works perfectly the way its supposed.
but the thing is that i want to make the script clickable, in finder, i renamed it to script.command, and if i run it from finder, it assumes that its workingdirectory is /Users/jago/

instead of /Volumes/BIGMAMA/crypto
eaven if the script is placed in the lastfolder, and i run it from there.
Could it be some setings in the terminal?, because i see no expl for it to behave this way.

Quote:
Originally Posted by karudzo
simply change the place in the script that reads:

~/whatever or /Users/yourusername/whatever

to a simple command.

For example if I had a script that said:
cp -R ~/example/ ~/backup/

it would back up the example directory in my home folder into a backup directory in my home directory. However if the script said:
cp -R example/ backup/

it would back up the example directory in the current directory into a backup directory in the current directory.

Hope that makes sense.
QUOTE Thanks

Post Reply New Thread Subscribe


« apple's x11 "XScrabble" need some help | Development »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

All times are GMT -4. The time now is 08:31 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?