On 04/21/16 01:38, Peter Hunkeler wrote:
>Put the whole string-to-set in double quotes and avoid the single quotes.
>Single quotes turn off variable replacement, so '$PWD' resolves to a
>literal dollar-P-W-D while "$PWD" resolves to the value you're after.
Sorry to contradict. In this particular case you do*not*  want the variables to be 
resolved at the time the string is assigned to the PS1 variable. You want the shell to 
find variable references each time it writes the content of PS1 to the terimnal and you 
want it to replace the variables found exactly at that time. $LOGNAME stays pretty 
stable, but $PWD changes with every "cd" command.

You are, of course, correct!
Depending on the shell, deferred substitution is exactly what the doctor ordered.


When you change the quotes to double quotes, PS1 will contian the current working 
directory at login time, and this will not follow you "cd"s.

I have never used the single-quote method for the $PWD effect, but I generally like it better than BASH'S "PROMPT_COMMAND".

-- R; <><




----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to