UNIX prompts (-ksh)
Rob Bernardo
rob at PacBell.COM
Mon Mar 27 23:52:38 AEST 1989
In article <4549 at vpk4.UUCP> hjespers at attcan.UUCP (Hans Jespersen) writes:
+In article <2391 at buengc.BU.EDU> bph at buengc.bu.edu (Blair P. Houghton) writes:
+>In article <11080 at well.UUCP> tneff at well.UUCP (Tom Neff) writes:
+>>Actually not even the classic Korn shell solution of
+>>
+>> export PS1='$PWD> '
+>>
+>>seems to work everywhere.
+
+>I don't know ksh, but all the other shells I've seen use single-quotes
+>to protect against variable substitution...
+
+Absolutely correct. I think Tom ment
+
+ export PS1=`$PWD> `
+ ^ ^
Absolutely wrong. :-) The above will set PS1 to be your current working
directory ***at the time it was set***. It will not change from command
to command no matter how much you "cd". On the other hand, the following:
export PS1='$PWD> '
will set PS1 to literally be "$PWD> ". Then, you ask, wouldn't the prompt
come out as literally "$PWD> ". The answer is no. The two environmental
variables ENV and PS1 undergo variable substitution by ksh *when used*.
This is why you can put $PWD in PS1 and have it reflect your cwd as it
changes with each command.
--
Rob Bernardo, Pacific Bell UNIX/C Reusable Code Library
Email: ...![backbone]!pacbell!pbhyf!rob OR rob at pbhyf.PacBell.COM
Office: (415) 823-2417 Room 4E850O San Ramon Valley Administrative Center
Residence: (415) 827-4301 R Bar JB, Concord, California
More information about the Comp.unix.questions
mailing list