In .bash_profile, should PS1 be defined before exporting?

As an example, the first line in my .bash_profile is currently:

export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "

But instead, should it be:

PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export PS1

1 Answer 1


In korn shell and bash, you can do it in one line. The original bourne shell required your second syntax, where you set it on one line and then exported it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .