[Top][All Lists]

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

Re: Bug on bash shell - $PWD (and consequentely prompt) not updated whil

From: Lawrence Velázquez
Subject: Re: Bug on bash shell - $PWD (and consequentely prompt) not updated while renaming current folder.
Date: Fri, 19 Jun 2020 22:15:42 -0400


> On Jun 19, 2020, at 8:51 PM, correio@goncalo.pt wrote:
> Bash Version: 5.0
> Patch Level: 11
> Release Status: release 
> Description: 
> When we rename the current working directory, $PWD doesn't get updated
> as it would as it would if we just did a simple "cd directory". Because
> of that, the prompt will continue also to show the old current
> directory's name, and not the new name the folder has. But the problem
> comes from the current working directory's variable itself (proven by
> "echo $PWD") and not by the prompt itself. So it's a lot worse than a
> simple prompt update but, it has to do with with environment variables
> themselves. As environment variables are session-specific, I submitted
> this to you and not to the kernel bug tracking. Please tell me if I
> should inform other bug tracking also. Thanks.

I'd be hard-pressed to call this a bug, considering that bash is hardly the
only shell that behaves this way.

% cat /tmp/test
rm -fR /tmp/old /tmp/new
mkdir /tmp/old
cd /tmp/old
printf 'pre-mv:  %s\n' "$PWD"
mv /tmp/old /tmp/new
printf 'post-mv: %s\n' "$PWD"

% bash --version | head -n 1
GNU bash, version 5.0.17(1)-release (x86_64-apple-darwin18.7.0)
% bash /tmp/test
pre-mv:  /tmp/old
post-mv: /tmp/old

% zsh --version
zsh 5.8 (x86_64-apple-darwin18.7.0)
% zsh /tmp/test
pre-mv:  /tmp/old
post-mv: /tmp/old

% ksh --version
  version         sh (AT&T Research) 93u+ 2012-08-01
% ksh /tmp/test
pre-mv:  /tmp/old
post-mv: /tmp/old

% port -q installed dash
  dash @ (active)
% dash /tmp/test
pre-mv:  /tmp/old
post-mv: /tmp/old

% yash --version | head -n 1
Yet another shell, version 2.48
% yash /tmp/test
pre-mv:  /tmp/old
post-mv: /tmp/old


reply via email to

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