Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Having a little issue someone might be able to help me out with. I've created a number of Bash scripts for automating some of my common day to day tasks on my Snow Lepoard Machines. All of these scripts live in a DropBox folder that is shared across my machines.

The path is the same on all machines: e.g. /User/myuser/Drobox/Bash\ and\ Batch/ I've added the folder to my /etc/paths

Path Variable:

/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/myuser/Dropbox/Bash\ and\ Batch:/usr/local/git/bin:/usr/X11/bin

My issue is not being able to run the scripts from outside their directory. All scripts have necessary permissions e.g.: 755

Scripts can be run when in the directory:

mymachine:~ myuser$ cd Dropbox/Bash\ and\ Batch
mymachine:Bash and Batch myuser$ ./uni-update.sh
Update University Repository
At revision 246.

But not from outside of the directory:

mymachine:~ myuser$ ./uni-update.sh
-bash: uni-update.sh: command not found

What am I missing here?

Thanks in advance.

share|improve this question
up vote 4 down vote accepted

You must not prefix the command with ./.

It means "Use the uni-update.sh in the current directory". You do this for commands that are not found on the path, or to specify a different version or completely different program of the same name.

Run it simply as uni-update.sh and you're good.

share|improve this answer
    
Tried that.. No luck.. Still get the same error: -bash: uni-update.sh: command not found – Jeremy Cade May 22 '11 at 4:25
1  
@Jeremy Try removing the backslash escapes from the spaces in /etc/paths. If that doesn't work, what is the result of echo $PATH ; which uni-update.sh ; find ~ -type f -name uni-update.sh ; ls -l /Users/myuser/Dropbox/Bash\ and\ Batch/uni-update.sh? – Daniel Beck May 22 '11 at 7:03
    
mymachine:~ myuser$ echo $PATH ; which uni-update.sh ; find ~ -type f -name uni-update.sh ; ls -l /Users/myuser/Dropbox/Bash\ and\ Batch/uni-update.sh /Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/s‌​bin:/usr/local/bin:/Users/myuser/Dropbox/Bash\ and\ Batch:/usr/local/git/bin:/usr/X11/bin /Users/myuser/Dropbox/Bash and Batch/uni-update.sh -rwxr-xr-x@ 1 myuser staff 101 24 Mar 20:29 /Users/myuser/Dropbox/Bash and Batch/uni-update.sh – Jeremy Cade May 22 '11 at 12:37
    
@Jeremy looks good so far, except that the PATH entry is clearly not recognized. Have you tried removing the backslashes from /Users/myuser/Drobox/Bash\ and\ Batch/, as I suggested? – Daniel Beck May 22 '11 at 12:42
    
@Daniel, I did.. The strange thing is that it works fine on all of my other machines. Go figure.. – Jeremy Cade May 23 '11 at 6:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .