Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When using the default PS1 prompt that MAC OS/Terminal comes with, when you type sh you get a new style prompt.

station-4:~ user$ sh
sh-3.2$ 

When you export your own PS1, this functionality goes away. You type sh and you still get the PS1 prompt you specified. Why is this?

station-4:~ user$ export PS1=">>>"
>>>sh
>>>
share|improve this question
    
Try which sh to see what your shell is, and check the result for symlinks. –  Kerrek SB Jul 2 '11 at 11:07

1 Answer 1

up vote 4 down vote accepted

"Export" is the key word. I don't have a Mac myself, but my guess is that its bashrc file doesn't export $PS1, merely sets it, so that bash itself sees the variable but doesn't push it to the environment of new processes. (bash is the default shell used by OS X.)

You can use printenv PS1, env | grep ^PS1 or declare -p PS1 to find out whether a variable is part of the environment. (You will see declare -x if the variable is exported, declare -- otherwise.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.