Logged in as user1, I'd like to project to another unix user env, let's say user2, without type it's password.By project, I mean:- change current $HOME- call user2's bash startup scripts (to get it's prompt and global vars)What I've written a little script switch_user_env.sh:HOME=/usr/users/$1cd $HOMEbash. /etc/profileif [ -f $HOME/.bash_profile ]; then    . $HOME/.bash_profilefiif [ -f $HOME/.profile ]; then    . $HOME/.profilefiI call it like following: . ./switch_user_env.sh user2Current shell get correctly change to bash but startup scripts are not called.Can you help me to understand what is wrong ?Thanks ![EDIT]switch_user_env.sh source code is available in GitHub: https://github.com/pierrefevrier/switch-user-env
Change unix user environment
linux
Because remaining part your script (after bash call) will be executed after you exit from bash (type exit command or Ctrl+d). Calling bash in your script takes the control of futher execution.Here is updated version:HOME=/usr/users/$1cd $HOMESOURCE_PROFILE=/etc/profileif [ -f $HOME/.bash_profile ]; then    SOURCE_PROFILE=$HOME/.bash_profilefiif [ -f $HOME/.profile ]; then    SOURCE_PROFILE=$HOME/.profilefibash --rcfile $SOURCE_PROFILE