[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pwd or shell prompt doesn't update after renaming a parent dir
From: |
Chet Ramey |
Subject: |
Re: pwd or shell prompt doesn't update after renaming a parent dir |
Date: |
Thu, 25 Mar 2010 08:59:49 -0400 |
> Bash Version: 4.0
> Patch Level: 33
> Release Status: release
>
> Description:
> suppose there is a dir called "1" when i'm in it and i use "mv ../1
> ../44" command for example, mv does the job. but nor pwd or shell prompt
> does not show the change until i go back to the parent of "1" directory.
By default, bash uses a logical view of the file system, in which $PWD
and pwd report the current directory using the path used to get there.
If you don't want bash to do that by default, use `set -o physical' or
`pwd -P'. `pwd -P' will show the true physical path, but not modify
$PWD.
If you want bash to re-evaluate its idea of the current working
directory, which is reflected in $PWD, you have to force that
reevaluation. Bash doesn't and can't know that the directory path has
changed underneath it. You can use `cd .' to force bash to recompute
the current directory path if you change parent directories.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/