In Ubuntu 16.04 I have a directory nearly 10 files, each containing a single Bash script files:
"$HOME"/myScripts/x.sh
"$HOME"/myScripts/y.sh
...
Instead creating nearly 10 different aliases to each one of these files in bashrc
:
alias "$HOME"/myScripts/x.sh
alias "$HOME"/myScripts/y.sh
...
is there a way to create one "global" alias, that will hold the path of that direcotry ("$HOME"/myScripts/
) and will let me access execute each of the files, but also without their .sh
extension?
For example, I'll execute in console:
x
and "$HOME"/myScripts/x.sh
will be executed.
I wouldn't really use a non intuitive name like x
, it's just for example.
The minor problem to solve here is to save the amount aliases, easing their maintenance. The more one works with directories dedicated to some contexts of software, the more this method would be handy, I assume.
Update
In the end what I did is to create a file with many Bash functions, I then sourced the file, and then exported the functions in it:
export -f myFunc_0 myFunc_1 ...
There might be a simple global way to export these but I don't know of one.