bash alias doesn't carry over with sudo
- by agent154
I'm curious if there's a way to get my .bash_profile to work when I sudo a program.
For example, I have it set to alias emerge='emerge -av' so that I can install software, and it will always ask me if I want to proceed before downloading and installing. However I just noticed when I sudo emerge foo, it defaults to just the plain command emerge foo instead of emerge -av foo.
Only thing that comes to mind to fix this is to also put the alias in root's .bash_profile, but I don't want to have to resort to that since I will always have to make changes in two places when I want to add stuff to my own profile.
Is there another way around this that I'm unfamiliar with?