On Sun, 1 Oct 2017, Chet Ramey wrote:

> On 9/30/17 4:20 AM, Mikulas Patocka wrote:
> 
> > Is there some reason why do we need to check if $OLDPWD is a real 
> > directory? dash and ksh accept the $OLDPWD variable, but don't poke it 
> > with the stat syscall. zsh clears $OLDPWD.
> 
> It makes no sense to inherit it if it doesn't name a directory (or
> "pathname" in the Posix standard), other than the sort of lazy evaluation
> that will prevent your particular problem.

Does something bad happen if we inherit $OLDPWD that points to a 
non-existing directory? Will some script malfunction because of it?

Mikulas

> This is the same reasoning that rejects inheriting PWD if it doesn't name
> the current directory.
> 
> -- 
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/
> 

Reply via email to