PS1 shell variable should be set in
~/.bashrc for the
bash shell as that is the initialisation file that is read for interactive shell sessions.
Note that this variable is a shell variable, not an environment variable (it does not make sense to let child processes inherit its value, and it's only the current shell that uses it). It therefore does not need to be exported with
You shouldn't need to start
bash from any of the shell's startup files. Starting a particular shell from
~/.profile (or the corresponding file related to your login shell) may possibly be warranted if the system that you're running on does not allow you to change your login shell. Care should be taken to not start the other shell if that is the shell already executing the file though, or you may end up in an infinite loop of sorts.
exec code that you add to your
~/.bash_profile should never be needed. I suppose it's a way of getting
~/.bashrc to be parsed (it starts an interactive shell, and interactive
bash shells read
~/.bashrc). A better way of doing that would be to have one of the files source the other, for example using this in
if [[ -f $HOME/.bashrc ]]; then
~/.bashrc (there should be no need to touch
The other thing that the command does is to clean out all other environment variables using
env -i. Unless you have very specific reasons to do this, you should not do that from your ordinary shell startup files.