Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!amdahl!pacbell!pbhyf!rob From: rob@PacBell.COM (Rob Bernardo) Newsgroups: comp.unix.questions Subject: Re: UNIX prompts (-ksh) Message-ID: <4896@pbhyf.PacBell.COM> Date: 27 Mar 89 13:52:38 GMT References: <18805@adm.BRL.MIL> <11080@well.UUCP> <2391@buengc.BU.EDU> <4549@vpk4.UUCP> Reply-To: rob@PacBell.COM (Rob Bernardo) Organization: Pacific * Bell, San Ramon, CA Lines: 33 In article <4549@vpk4.UUCP> hjespers@attcan.UUCP (Hans Jespersen) writes: +In article <2391@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes: +>In article <11080@well.UUCP> tneff@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@pbhyf.PacBell.COM Office: (415) 823-2417 Room 4E850O San Ramon Valley Administrative Center Residence: (415) 827-4301 R Bar JB, Concord, California