Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My question is simple.

Why ubuntu don't support sh example.sh command?

It's more convenient than cd $wd; ./example.sh and add PATH in some situation.

login.sh

~/bin/logmitgw.sh -i 4564646 dfdsfsdf

logmitgw.sh

some code

When I'm running sh ~/bin/login.sh

It print

sh: 0: Can't open ~/bin/login.sh

ls -l ~/bin/login.sh

-rwxrwxr-x
share|improve this question
1  
What is cd $wd? –  Mowgli Nov 18 '12 at 4:13
    
change working directory to the shell directory –  qingfeng Nov 18 '12 at 4:17
2  
You need to be more specific about your problem. The example you gave (sh example.sh) should work, unless the script you are trying to execute requires another shell or interpreter different from sh. –  Salem Nov 18 '12 at 4:21
    
@Salem I have edited my question. –  qingfeng Nov 18 '12 at 4:29
    
Please include the output of "ls -l /bin/login.sh" –  andol Nov 18 '12 at 4:32
show 1 more comment

1 Answer 1

up vote 1 down vote accepted

If the script is in ~/bin then ~/bin will already be in the path. As long as it's a bash script you can execute it from anywhere at all. No need to shell, no need to cd, and no need to add anything in your path.

eg:

login.sh
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.