.command [Where am i?]

J

jago svensson

Guest
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
 
Joined
May 27, 2006
Messages
445
Reaction score
16
Points
18
Location
Concord, NC
Your Mac's Specs
Macbook Pro 17" 2.6GHz 4GB RAM
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.
 
OP
J

jago svensson

Guest
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.

karudzo said:
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.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top