I want to source a file in .bashrc only for my user id when I sudo to the functional id. it should not be sourced when other user sudo in.
1 Answer
add to the .bashrc
[[ -f .$(logname).bashrc ]] && source .$(logname).bashrc
and put your commands into the
.your_login.bashrc
If you don't have logname
command can use
who am i | awk '{print $1}
instead of the logname