[TUHS] What's In a Prompt String?

Edouard Klein via TUHS tuhs at tuhs.org
Wed Apr 29 06:08:41 AEST 2026


Hi,

Can't answer precisely for older UNIX shells, but rc uses ";"

The FreeBSD man page for rc says

 prompt (default)0
	      This variable holds the two prompts (in list  form,  of  course)
	      that  rc	prints.	 $prompt(1)0 is	printed	before each command is
	      read, and	$prompt(2)0 is printed when input is expected to  con-
	      tinue  on	 the next line.	 rc sets $prompt0 to ('; ' '')0	by de-
	      fault.  The reason for this is that it enables  an  rc  user  to
	      grab  commands from previous lines using a mouse,	and to present
	      them to rc for re-interpretation;	the semicolon prompt is	simply
	      ignored by rc.  The null $prompt(2)0 also	has its	justification:
	      an  rc  script,  when  typed  interactively,  will   not	 leave
	      $prompt(2)'s0  on	 the screen, and can therefore be grabbed by a
	      mouse and	placed directly	into a file for	use as a shell script,
	      without further editing being necessary.


On 9fans, Uriel said back in 2005:

"Edit any line in your window, double click at the start or end of the
line to select it, and then Middle-click->Send; is a very common and
useful idiom(note that in the default profile your shell prompt is
defined as a NOP function precisely for this)."


But the Plan 9 and 9front's rc(1) man page, and inferno's sh(1) man page
mention "%" instead. I don't know why for Inferno, as its shell does
indeed prompt with ";", the source is here
https://github.com/inferno-os/inferno-os/blob/master/appl/cmd/sh/sh.y#L347

I should get around to fixing the man page then ;)

Anyway, that's at least one PS1 with an actual engineering/UI/UX
rationale behind it.


segaloco via TUHS <tuhs at tuhs.org> writes:

> 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.


More information about the TUHS mailing list