[TUHS] What's In a Prompt String?
Steffen Nurpmeso via TUHS
tuhs at tuhs.org
Wed Apr 29 05:35:05 AEST 2026
Steve Nickolas via TUHS wrote in
<alpine.DEB.2.21.2604281508510.3328 at sd-159945.dedibox.fr>:
|On Tue, 28 Apr 2026, segaloco via TUHS wrote:
|
|> UNIX has had several ubiquitous PS1s: @, %, $ and then a PS2 of >, with
|> these values also being configurable. I've seen in various BTL media
|> folks using a . (period) or occasionally a $ but with no space between
|> the prompt and the command. I've always assumed the former was
|> influenced by DEC and the latter by IBSYS control cards (e.x. $JOB,
|> $EXECUTE, etc. pre-JCL stuff).
|>
|> Is there any history on the rationale for default PS1 selections between
|> various shells? Worth noting that % seems to be the most commonly
|> implemented but $ is what more people are familiar with due to the
|> adoption of the Bourne shell by V7 and subsequently various standards.
|> I mention the % as more common as it seems to be default in a greater
|> number of shells despite Bourne family generally having more uptake
|> (afaik).
|>
|> Did these choices of symbols have any particular significance? I can't
|> recall where I read it but I heard suggested the original UNIX shell
|> used '@' as a prompt as it looks like a snail shell. Can't verify this,
|> nor do any stories of the other symbols come to mind. I've found the
|> ubiquity of PS2 '>' in graphical icons for terminal emulators odd.
|> That's not a super common prompt to see on UNIX compared with the
|> others, I find it strange that is often the prompt character chosen for
|> icons, implying users are often sitting at a PS2 prompt?
|>
|> - Matt G.
|>
|
|At one point tcsh's default prompt was "> ".
|
|Also CP/M and MS-DOS's "A>" could be an influence, and some BASIC
|interpreters had ">" prompts?
Regarding shells Sven Mascheck is a good address to look at [1],
generally speaking. He says v7 shell came with PS2 functionality,
and links a manual that says
PS1 Primary prompt string, by default `$ '.
[for UID 0 that was "# " instead]
PS2 Secondary prompt string, by default `> '.
Actually only V1 had
at:
<@ >
anything C language like was like
promp = "% ";
if(((uid = getuid())&0377) == 0) {
promp = "# ";
from V4 on (and i think no shell sources of V2 and V3).
[1] https://www.in-ulm.de/~mascheck/bourne/index.html#svr2
POSIX then standardized what was in v7, that much is plain.
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
More information about the TUHS
mailing list