Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

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.