vote up 13 vote down star
4

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 > would have been more suggestive in my opinion.

flag
3  
Though not programming-related, certainly computer-related, thus better at Super User, I think. – Johannes Rössel Oct 19 at 23:13
I want to know the answer, too. I'll look for it on SU. – Gabriel Hurley Oct 19 at 23:14
7  
It's the Bourne shell prompt, not the Unix prompt. The default csh prompt is %. – wfaulk Oct 20 at 1:58
wfaulk, I wish I could upvote your comment more than once. – Richard Marquez Oct 20 at 2:07
4  
€ didn't exist yet... – mouviciel Oct 20 at 8:30
show 1 more comment

migrated from stackoverflow.com

4 Answers

vote up 8 vote down

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 was harder to track. Thankfully Bell Labs still holds the manual (there were no man pages in 7. Version 8 introduced them). Again search the page for prompt and you will come to this:

When you have finally gone through this entire process without provoking any diagnostics, the resulting program can be run by giving its name to the Shell in response to the `$' prompt.

  • What about version 6? Version 6 Unix wasn't hard to track. But hard to find the relevant information. The documentation is available here. I finally found it under beg/u1. At some point you read:

The culmination of your login efforts is a percent sign ``%''. The percent sign means that .UC 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 in 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 has 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.

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

link|flag
1  
Version 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 Oct 20 at 1:59
Also, the Bourne shell was developed by Stephen Bourne. – wfaulk Oct 20 at 2:01
Yup. 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 Oct 20 at 2:06
Yeah, but he developed the shell pretty much by himself, and it must have been he who decided to use $. – wfaulk Oct 20 at 2:29
Also, there were man pages at least as far back as Version 3: minnie.tuhs.org/UnixTree/V3/usr/man/man1 – wfaulk Oct 20 at 2:32
show 1 more comment
vote up 1 vote down

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.

link|flag
1  
He's asking for the actual origin, not for what people guess it might be. – davr Oct 20 at 0:08
Don't get snarky. Judging from the other answers posted here, it appears that nobody really knows for sure anyway. – Robert Harvey Oct 20 at 21:13
vote up 1 vote down

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.

link|flag
1  
The Bourne shell didn't exist until Version 7. – wfaulk Oct 20 at 2:20
Well, 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 Oct 20 at 17:47
vote up 1 vote down

Sadly, I can't answer the question, but I can give you a few pointers.

link|flag

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.