86
28
The UNIX prompt uses a $
symbol to indicate that your input is expected.
I was wondering why this symbol was chosen—if there is a reason. Dollar just seems a little unexpected. A >
symbol would have been more suggestive in my opinion.
86
28
The UNIX prompt uses a $
symbol to indicate that your input is expected.
I was wondering why this symbol was chosen—if there is a reason. Dollar just seems a little unexpected. A >
symbol would have been more suggestive in my opinion.
60
Let's explore a little:
Version 8 Unix is easy. There's still man pages available. Get to the sh man page and search for prompt. You'll get to a point where you read:
PS1 Primary prompt string, by default “$ ”.
PS2 Secondary prompt string, by default “> ”.
So let's see if that was the first.
Version 7 Unix man pages are still
available, and the sh
man page
gives the same description of prompts as
Version 8.
What about version 6? Version 6 Unix
wasn't hard to track. But its sh
man page doesn't mention prompts at
all. The “Getting started” guide
comes in handy here; it mentions:
The culmination of your login efforts is a percent sign “%”. The percent sign means that UNIX is ready to accept commands from the terminal.
Aha! So version 6 didn't have it. Version 7 was the first! Released in 1979.
Happy? Hate to rain on your parade, but don't be :)
Problem is that version 6 was one inspiring Unix. Look at the variants here. Can it be that the $ sign as a command prompt was not started in Version 7, but instead in one of these variants and then the idea incorporated into 7?
At this point I got tired of hunting for operating systems documentation from a time when I was 6. This at least narrows it down considerably. We know Version 7 was the first Bell Labs release to show the $ sign as a command prompt. All we need to be sure is that none of those Version 6 variants introduced it. It makes sense for this change to have appeared in Version 7 though since that’s the release which introduced the Bourne shell, replacing the Thompson shell used in previous versions of Unix (and the Massey shell used in Programmer's Workbench Unix).
One last thought though:
While the idea of $ being a hint to the word shell or script is appealing and makes all sense, don't expect this to ever be officially confirmed. Unix development was shared by a rather large group of people with much bigger concerns in life than keeping track of how a symbol evolved. And some of these extraordinary programmers are not even among us anymore.
Most probably, the best you can hope to get from the question "What is the origin of the UNIX $ (dollar) prompt?" is the name of the first Unix shell introducing it.
3
A possible source of inspiration for Bourne: the MTS FORTRAN-IV/WATFIV manual from 1978 describes punch-card input: "control cards" include "commands ... that always start with a dollar sign ($) in column 1."
– cxw – 2018-04-16T16:02:36.9404Version 7 was the first Unix with the Bourne shell. It replaced the Thompson shell in Version 6. So this being a delineation between shell prompts makes sense. – wfaulk – 2009-10-20T01:59:36.020
Also, the Bourne shell was developed by Stephen Bourne. – wfaulk – 2009-10-20T02:01:10.683
1Yup. We pretty much can trace it to the Bourne Shell. As for the author, no doubt about it. But he was an employee at Bell Labs just like everyone else. – A Dwarf – 2009-10-20T02:06:58.910
Yeah, but he developed the shell pretty much by himself, and it must have been he who decided to use $. – wfaulk – 2009-10-20T02:29:07.673
1
Also, there were man pages at least as far back as Version 3: http://minnie.tuhs.org/UnixTree/V3/usr/man/man1/
– wfaulk – 2009-10-20T02:32:07.7932Back in sixth edition days and before, UNIX was distributed with full source code included. All the universities who got it tended to do local modifications (that's where BSD came from) so perhaps some local systems programmer at the University of Waterloo though that a "shell" prompt should look more like a snail, and changed the % to an @. And as you say, there were lots of variants, and when they got collated back together in v7, no doubt the origins of changes were already fuzzy. – Michael Dillon – 2009-10-20T17:51:44.630
9
The original Bourne shell prompt was a snail shell, "@". I remember this on UNIX 6th edition which, I believe, is before UNIX was sold commercially. So the switch to a $ sign could be related to commercialisation of UNIX, as Robert suggested, $hell.
3The Bourne shell didn't exist until Version 7. – wfaulk – 2009-10-20T02:20:15.177
2Well, we just called it "the shell" so I don't really know who wrote it. I do remember seeing posters with all the shell commands documented on them, arranged in a spiral like a snail-shell or at sign. Maybe it was from O'Reilly but I can't be sure. – Michael Dillon – 2009-10-20T17:47:30.537
8
Actually, the standard command-line prompt in Linux for a normal user account using Bourne, Bash or Korn shell is the dollar sign ($) while the root prompt is a hash mark (#). By contrast the traditional C shell prompt is a percent sign (%).
If I were to guess, the $ is reminiscent of the word $hell, which is probably why it was chosen.
For what it is worth, this was the answer I was looking for because I never can remember which is which. – John Leidegren – 2019-03-09T06:50:04.077
4He's asking for the actual origin, not for what people guess it might be. – davr – 2009-10-20T00:08:04.287
6Don't get snarky. Judging from the other answers posted here, it appears that nobody really knows for sure anyway. – Robert Harvey – 2009-10-20T21:13:04.083
1I guess the root prompt # is so chosen to coincide with the comment character, reducing the chances of accidentally pasting dangerous commands... or maybe not! I don't think they had much in the way of cut-and-paste back in the day. – Sam Watkins – 2013-03-12T01:22:03.860
7
Sadly, I can't answer the question, but I can give you a few pointers.
2
Attention: this may not be true, its just a wild guess:
I have a feeling that $
is a psychological reminder.
We have to remember that back then, there wasn't a digital prompt, only a paper "teletype" (tty
). And probably the dollar was to say "you're wasting paper and money keeping this phone line up. just enter some commands already!!".
One of the greatest question hereabout! – dag729 – 2010-04-24T23:32:49.280
3Though not programming-related, certainly computer-related, thus better at Super User, I think. – Joey – 2009-10-19T23:13:25.417
I want to know the answer, too. I'll look for it on SU. – Gabriel Hurley – 2009-10-19T23:14:49.920
24It's the Bourne shell prompt, not the Unix prompt. The default csh prompt is %. – wfaulk – 2009-10-20T01:58:08.753
1wfaulk, I wish I could upvote your comment more than once. – Richie Marquez – 2009-10-20T02:07:41.887
18€ didn't exist yet... – mouviciel – 2009-10-20T08:30:11.217