Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: inherit OLDPWD from environment variable
On Fri, Jul 19, 2024, at 9:55 PM, Franklin Yu wrote:
> - oldpwd = ztrdup(pwd); /* initialize `OLDPWD' = `PWD' */
> + oldpwd = zgetenv("OLDPWD");
> + if (oldpwd == NULL || oldpwd[0] == '\0')
> + oldpwd = ztrdup(pwd); /* initialize `OLDPWD' = `PWD' */
If we're going to begin importing OLDPWD from the environment, we
might as well align with other shells for consistency, which means
accepting a zero-length value as is. This is how bash 5.2.26, dash
0.5.12, ksh93u+ 2012-08-01, mksh R59, and yash 2.56.1 all behave.
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author