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!)

link|improve this question

feedback

1 Answer

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
link|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 at 11:27
feedback

Your Answer

 
or
required, but never shown

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