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

I wrote a very simple script that looks like that:

$ cat pack.sh
#!/bin/bash
cd log
rm development.log
cd ..
tar zcvf my_tar_ball.tar.gz *

But, it doesn't work:

$ pack.sh
pack.sh: command not found

which bash returns /bin/bash, and pack.sh is executable:

$ ls -ll pack.sh 
-rwxrwxr-x 1 misha misha 75 2012-02-04 22:11 pack.sh

What could be the problem?

(BTW, source pack.sh does work!)

share|improve this question
up vote 4 down vote accepted

If you did not put the scripts directory in your PATH(which is a environment variable), and . (the current directory) is not in the PATH either, you can activate the script like this:

$ ./pack.sh
share|improve this answer
    
Ignore my answer, @kev updated their answer To add to kev's answer, the reason why it doesn't work without ./ if front of it is because the current directory is not in $PATH. – lupincho Feb 5 '12 at 11:27

You must log in to answer this question.

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