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.

the problem I have is the following, I recently installed Ubuntu and was setting up a map where I could collect all my scripts. The map I use is the bin folder on the location:

/home/myusername/bin

But now when I try to execute the script from my home folder it doesn't work: sh: 0: Can't open test.sh.

Does anyone have an idea why this is?

share|improve this question
    
If you walk us through the steps you took to try to set this up and the behavior expected, it will be easier to help you get this set up. –  Danny Dyla Mar 22 '13 at 10:08
    
I had a nice picture of a command box with the code I used step by step but I couldn't upload it because my reputation was too low :D –  Dries Van Eyck Mar 22 '13 at 10:17
    
Usually if you link a picture from imgur or similar and it is actually helpful, someone with the correct reputation will edit your post to make the image viewable. You could also just copy it into your buffer and use the <$> tool in the editor to add it. –  Danny Dyla Mar 22 '13 at 10:21

2 Answers 2

Add your bin folder to the $PATH, or call the script as ./bin/myscript.

share|improve this answer
    
I got it to work! (from the /home/myusername/bin folder) apparantly when executing a script from a folder you do it with test.sh instead of sh test.sh –  Dries Van Eyck Mar 22 '13 at 10:10

Open your /home/username/.bashrc file and add the following string:

alias command_name='/path/to/script'

for example you want to create a commmand named test1 and the script is in /home/your_user/scripts/test.sh so you just write in /home/your_user/.bashrc

alias test1 = '/home/your_user/scripts/test.sh

Hope this will work.

share|improve this answer
    
it works but it is however not really what I'm looking for. if I use this method I will have to add an alias every time I add a new script. I was looking to make one map where I can throw everything in and just execute from there. is this possible in any way shape or form ? –  Dries Van Eyck Mar 22 '13 at 9:40
    
Then try to put your scripts in /usr/bin or /usr/sbin and relogin in terminal. This should work. –  Ivan Mar 22 '13 at 9:45

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.