2

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?

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407
Unknown
  • 205

1 Answers1

3

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 the 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
Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407