The environment variable for the bash prompt is called PS1 (usually set in ~/.bashrc). What does PS1 stand for? Is there a PS2?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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.
Method 2
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
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0