MacOSX how to autorun a script after su - root?
问题 Lets assume i am normal user, the i will switch to root: user ~ $ su - root Password: root ~ # So once i logged in as root , i want to run following command automatically: source .bash_profile How can i have that above command run automatically please? 回答1: According to the bash man page, .bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells. In your case, you don't need to source .bash_profile like this. You just need to put source .bash