Hey everyone!
I have my .bash_profile file which is read automatically when I launch Terminal therefore I can run my own functions.
BUT.
When I do:
No matter what I do, I can't get the .bash_profile file to be sourced automatically so I end up having to run different commands.
Example: I have this function:
Running:
Output:
Running:
Output:
So I end up having to type:
Any possible way I can make shell source .bash_profile automatically when logging as sudo?
Thanks!
P.S: I know I can just add it to the bashrc file in /etc/, I'd just like to avoid that workaround.
I have my .bash_profile file which is read automatically when I launch Terminal therefore I can run my own functions.
BUT.
When I do:
Code:
sudo -s
Code:
sudo su
Code:
sudo su -
Example: I have this function:
Code:
aaa(){
if [ `id -u` -eq 0 ]
then rm ~/Whatever/*
else echo PERMISSION DENIED
fi
}
Code:
aaa
Code:
PERMISSION DENIED
Code:
sudo aaa
Code:
sudo: aaa: command not found
Code:
sudo -s
source ~/.bash_profile
aaa
Thanks!
P.S: I know I can just add it to the bashrc file in /etc/, I'd just like to avoid that workaround.