bash alias doesn't carry over with sudo
Posted
by
agent154
on Super User
See other posts from Super User
or by agent154
Published on 2012-06-26T00:23:17Z
Indexed on
2012/06/26
3:18 UTC
Read the original article
Hit count: 787
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?
© Super User or respective owner