I am trying to alias the command
sudo shutdown but in my
.profile I can't just do
alias "sudo shutdown"="my command". Is there another way to alias multi-worded commands in Unix?
migrated from stackoverflow.com Feb 11 '11 at 2:10
The alias name is on the left hand side, so you can have any multiworded command in the right:
EDIT: However, if you really want to have aliases names of multiple words -- in your example, if you really want "sudo shutdown" to be the alias, you can work around this by using the following alias feature (in the bash manual):
So, if you still want to use
Use a function:
I prefer to just put a executable file in /usr/local/bin (be sure that is in your path) that then contains the commands I wish to run. The name of the script would be the command that comes up. be sure to chmod +x /usr/local/bin/your_script.
So the script could be called 'shutdown'
The contents of the file shutdown would be:
That opens a whole new world. You could then have a couple commands or even a script: