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.

I have written on .bash_aliases to run my shell script:

alias testing='./testing' 

Problem I'm having right now is that it won't run the shell script.
On the terminal it says the "command not found".
May I know if anything wrong with what I've typed?


Edit:

I've found out that it only work after I typed source ~/.bashrc

Problem now is how do I run source ~/.bashrc upon starting of Ubuntu when I log in?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You should insert the complete past for the script:

alias testing='/path/to/testing'

If you use alias testing='./testing', the alias will work only your current working directory is the same with the script path.

Or you can add the path of the script to the PATH. Furthermore, if you use this method you will not need an alias anymore. See How to add a directory to my path? in this sense.

After you edited .bash_aliases file, to prevent a terminal restart or a re-login, you can use one of the following commands:

source ~/.bash_aliases

or

. ~/.bash_aliases
share|improve this answer
    
Edited. I've found out that it only work after I typed source ~/.bashrc Problem now is how do I run source ~/.bashrc upon starting of Ubuntu when I log in? –  Unknown Aug 20 '13 at 6:24
    
It will not work when you change the current working path in terminal (let say cd /). source ~/.bashrc is used precisely to prevent a terminal restart when you change the bash initialization files like ~/.bashrc or .bash_aliases - a re-login is too much –  Radu Rădeanu Aug 20 '13 at 6:31
    
How to first run the "source" when an user execute terminal? Like a startup application on Windows –  Unknown Aug 20 '13 at 7:30
    
@Guest I don't see any reason to do this... Anyway, if you have new questions, don't hesitate to use ask question button. –  Radu Rădeanu Aug 20 '13 at 7:34
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.