Its possible to run a script via Alias command. All you need is to modify the .bashrc and then source the script in the required user profile. Alias commands are very useful when it comes to running shortened versions of commands or a complex script to be run using just a single line of command. Currently I use this to run 2 of my custom scripts for waking up a ESXi server via WOL (Wake-ON-LAN).
All you need to do this first create (or) select a script you want to run as an Alias Command.
I have got 2 scripts located in /home/pi/
Now go ahead and edit the .bashrc file for a user who wants to run the command. In this case the user is ‘pi’ and file is “/home/pi/.bashrc”.
# vi /home/pi/.bashrc
Add the above 2 scripts to the end of the file so that they can be called by the command “wakie-esxi”
alias wakie-esxi='source /home/pi/hppl-1-vh.sh && /home/pi/hppl-2-vh.sh'
And then you can either log-off and login back for the changes to take effect (or) if you want to apply the changes on the fly without logging off then run this command as given below.
# source /home/pi/.bashrc
And that should be it and you should be able to call scripts via Alias commands.
pi@rasst ~ $ wakie-esxi hppl-1 is UP as on Mon Feb 8 09:36:16 GMT 2016 hppl-2 is UP as on Mon Feb 8 09:36:17 GMT 2016
If any issues please let us know via Contact Us and we will try our best to help you out.