it does not work because when you do:
bash /etc/profile
you open a new shell, execute the profile script, and get back to your current shell.
Actually, that's why to load the content of /etc/bash.bashrc
you do source /etc/bash.bashrc
in the /etc/profile
.
Thus to load it in your current shell, you should run:
source /etc/profile
instead.
Nota Bene:
- It's though a better idea to add your own aliases in
~/.bashrc
which gets automatically sourced by bash on load ;
- If you really want it to be global, follow @user1257931's suggestion about putting it in
/etc/profile.d
where it will be automatically sourced on new shell instances ;
- As @wich is suggesting, there's no reason to add an alias for
killprocessatport
to fuserfunction
. Though, you may prefer to do an alias for a call to the function with a parameter like: alias killhttpserver=fuserfunction 80
- It'd be also a good idea to use an explicit name for your
fuserfunction
, something like fuserkillproc
or even something better you may come up with…
HTH