As a trivial example, in user foo's ~/.bashrc there is an alias;
alias ll='ls -l'
Using sudo I can see the alias is set;
bar@laptop:~$ sudo -u foo -i alias ll
alias ll=`ls -l'
But, I can't actually use the alias;
bar@laptop:~$ sudo -u foo -i ll
-bash: ll: command not found
Commands that are bash functions work, OK. Is there a way to get the aliases to work also?
Try:
alias sudo='sudo '
http://www.shellperson.net/using-sudo-with-an-alias/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With