bug-bash
[Top][All Lists]
Advanced

[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: Robert Elz
Subject: Re: is it a bug that PWD=whatever sets PS1's \w to that regardless
Date: Wed, 17 Mar 2021 21:39:25 +0700

    Date:        Wed, 17 Mar 2021 09:12:19 -0400
    From:        Chet Ramey <chet.ramey@case.edu>
    Message-ID:  <f533cbca-ee17-dd6b-669e-ad4241b7bcd1@case.edu>

  | If you don't modify PWD, PWD always reflects the current working directory,

Of course, but how is that relevant?

But even that isn't actually specified, if one does a popd does PWD
not change?   The description of PWD (see just below) doesn't say it does.

  | If you modify PWD, as I said, all bets are off.

Does the man page say (or even hint) at that somewhere?   The only
references I can find to PWD are in the list of variables set by
bash, which says (in its entirety)

       PWD    The current working directory as set by the cd command.

but the description of the cd command says nothing about it at all.
(It does mention OLDPWD, but only in the context of specifying what
"cd -" means).

Aside from that definition, PWD is used to define the ~+ expansion,
and as best I can tell, those are the only references to it anywhere
in the doc.

There is a list of variables:

        The following variables are used by the shell.

but PWD is not in that list.  PWD is in the list:

           Shell Variables
                The following variables are set by the shell:

Some of those give details about what happens when they're modified,
(eg: DIRSTACK) some are listed as read only, PWD is just as above.

How do you expect a user to know that modifying PWD might cause bash
to halt and catch fire ?

I believe some work on the doc would be useful.

kre





reply via email to

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