I've always seen reference to pwd as being very essential 'back in the day'. These days we have customized command prompts like PS1 that display the current directory and pwd is pretty outmoded. But when did the idea for ps1 get introduced into *nix systems? Watching this from the AT&T archives I can see that PS1 definitely did not exist in the seventies.
1 Answer
This variable is part of the shell, $PS1
is used in bash
, the Bourne shell (sh
) and the ksh
, it is not used in the csh
.
The first UNIX shell was the Thompson Shell (which was also called sh
like the later bourne shell, the Thompson Shell was often called osh
on systems with both the Thompson and Bourne shell installed.) The Thompson shell used the variable $P
for the prompt.
Then the Bourne Shell was introduced which used $PS1
to set the prompt. ksh
was based on the Bourne Shell, and also uses $PS1
. The csh
/tcsh
used set prompt = <something>
.
So I think the first shell to use $PS1
was the Bourne Shell.
Thompson Shell man page: https://etsh.io/man/osh.1.pdf
Bourne Shell man page: http://heirloom.sourceforge.net/sh/sh.1.html
-
If the Thompson Shell had a variable for the prompt, $P, why did they never customize a prompt to display the working directory?– masMay 29, 2018 at 15:06
-
1You could do if you wanted to, I expect it just wasn't the convention back then. Remember they would have been using 80 character wide terminals where space was a bit more of a luxury. May 29, 2018 at 15:09
-
2So let me add the final answer to when did
PS1
first appear. It was 1976 in the Bourne Shell.– schilyMay 29, 2018 at 16:06