Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Suppose my_folder contains my_script and my_program. my_script tries to run ./my_program -myoptions. It works when I cd into the directory, but not when I double click on it.

Here is the output:

CasebashMac:~ chris$ /Users/chris/Programs/synergy-1.3.1\ 2/work_comp_server ; exit;
/Users/chris/Programs/synergy-1.3.1 2/work_comp_server: line 1: ./synergys: No such file or directory
logout

How can I fix this?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

"./synergys" is a path relative to the directory which you are currently in. To fix this you will need to specify an absolute path, for example:

/users/chris/Files/synergys

Obviously change it to a path that actually exists :)

Might be overkill, but there is a wikipedia page about paths:

Path_(computing)

share|improve this answer
    
Why isn't the script run in the path it resides when I double click? Is there a way to refer to paths relative to the script? –  Casebash Sep 17 '10 at 4:22
    
Assuming you are using a bash script, this question over at stackoverflow will help you out :) stackoverflow.com/questions/59895/… –  Nippysaurus Sep 17 '10 at 23:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.