I have this in .bashrc;
PS1=’$’
However, I see this still in terminal:
mas-macbook:some/path mas$
I want
$
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
PS1should already have been exported long before you get to your.bashrcfile, at least for a login shell. In that case, settingPS1should simply overwrite the value (not its export status).One thing to keep in mind is that bash itself does not run your
.bashrcfile for a login shell. The actual sequence of execution is:/etc/profile, if there.~/.bash_profile,~/.bash_loginor~/.profile.I’m fairly certain that, if you want
.bashrcto run for a login shell, it has to be sourced from one of those above.For example,
/etc/profilemay call/etc/profile.localor all the scripts in the/etc/profile.d/directory. Similarly, my.bash_profilecalls the following, if they exist:with the following snippet:
When I change
PS1and echo ‘hello‘ in my.bashrc, but comment out the sourcing of it in.bash_profile, the prompt doesn’t get changed (nor the string printed) when I log in. When I uncomment the sourcing, I get both the string printed and the prompt changed when I log in.To make sure that your
.bashrcis called for your login shells, put thatecho hellostatement just after settingPS1, then log in to check.If it is being called when you log in, you can execute ‘
export -p‘ from your shell to get a list of all the exported variables – make sure PS1 has a ‘declare -x‘ in front of it. If not, just change your.bashrcto export it as well:If it’s already exported, then something is changing it after your
setstatement. In that case, you’ll need to actually look at the login execution path to see what’s getting called before it gives you control.