Creating an alias for a bash script

You should try with alias menu='bash ./menuScript.sh'. I am not currently on a Linux machine, so cannot test it myself, but it should work. When you call the alias, it doesn't know what to do with the path, so you must include the bash at the beginning.

And resetting the terminal does help after making the change.


When you do

alias menu='./menuScript.sh'

you create am alias that says "that file" but doesn't say what to actually do with it.

However, if you do

alias menu='source ./menuScript.sh'

or

alias menu='. ./menuScript.sh'

You are saying run that file.


Did you remember to source your ~/.bashrc file after making the changes? Because the changes take effect in your .bashrc file after restarting your computer or simply sourcing the file.

Tags:

Bash

Alias