[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is it a bug that PWD=whatever sets PS1's \w to that regardless

From: Chet Ramey
Subject: Re: is it a bug that PWD=whatever sets PS1's \w to that regardless
Date: Wed, 17 Mar 2021 09:12:19 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 3/16/21 11:20 PM, Robert Elz wrote:

   | If you want to set PWD instead of letting cd/pushd/popd manage it,
   | all bets are off.

I agree with that as far as what you get when you expand $PWD (even the
pwd command, so using `pwd` as an alternative if PWD has been manually
set is not necessarily going to work), and even the way the cd command
works, but the bash man page says:

               \w     the current working directory, with $HOME abbreviated
                      with a tilde (uses the value of the PROMPT_DIRTRIM

Nothing about $PWD there, it should be the current working directory,

If you don't modify PWD, PWD always reflects the current working directory,
as it says in its description. If you modify PWD, as I said, all bets are

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]