75

The environment variable for the bash prompt is called PS1 (usually set in ~/.bashrc). What does PS1 stand for? Is there a PS2?

2 Answers 2

84

PS1 stands for "Prompt String One" or "Prompt Statement One", the first prompt string (that you see at a command line).

Yes, there is a PS2 and more! Please read this article and the Arch wiki and of course The Bash Reference Manual.

0
31

from slightly paraphrased from The Bash Reference Manual

PS1 The primary prompt string. The default value is ‘\s-\v\$ ’.

PS2 The secondary prompt string. ie for continued commands (those taking more than one line). The default value is ‘> ’.

PS3 The value of this variable is used as the prompt for the select command. ie for input into a running script. If this variable is not set, the select command prompts with ‘#? ’.

PS4 The value is the prompt printed before the command line is echoed when the -x option is set. The first character of PS4 is replicated multiple times, as necessary, to indicate multiple levels of indirection. The default is ‘+ ’.

PS1 and PS2 are from the original sh, PS3 and PS4 were added as part of bash

See examples here

You must log in to answer this question.

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