Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am centos 5.4 user and I can't run shell script outside its directry i.e my script is located:

/me/script.sh    

it will run as

./script.sh 

but not as

/me/script.sh 

it is 755 chmod, why its like that ?

cheers, /Marcin

share|improve this question
    
What is the error message you get when you run /me/script.sh ? –  Iain Oct 19 '10 at 12:16
    
nothing, just really does nothing –  Marcin Oct 19 '10 at 12:23
add comment

2 Answers

up vote 0 down vote accepted

What error does it give you?

Did you write it to be run from anywhere, or inside it does it call programs by relative path such as 'program' instead of '/me/program' and it now cannot find them?

share|improve this answer
    
its just echo program, really dummy stuff for testing purposes, then there is no dependencies at all –  Marcin Oct 19 '10 at 12:15
    
OK, got it, as you said, I have realized that I am running something what requires proper path, anyway, all fixed. –  Marcin Oct 19 '10 at 12:25
add comment

Run your shell script as bash -x /me/script.sh and see what's going wrong. There's no overall technical reason a script can't work outside your directory, so it's got to be something you're running that expects $CWD to be /me.

share|improve this answer
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.