zsh-users
 help / color / mirror / code / Atom feed
* `exec env -i OLDPWD=$OLDPWD zsh` doesn't work
@ 2017-01-13  9:15 Timothee Cour
  0 siblings, 0 replies; 2+ messages in thread
From: Timothee Cour @ 2017-01-13  9:15 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

how do i exec while passing OLDPWD?

related [but for bash]:
http://unix.stackexchange.com/questions/242909/why-does-bash-clear-oldpwd-when-a-child-script-is-started
 QUOTE: It seems reasonable to inherit OLDPWD if it names a directory, in
the same way that the shell inherits PWD if it names the current directory,
so we'll try that for the next bash version.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: `exec env -i OLDPWD=$OLDPWD zsh` doesn't work
       [not found] <CAM4j=kO9MSg-72LWog0N3OPumh8jy_xt4_T_fXEXAKQEk3eoXg__31721.773549407$1484300384$gmane$org@mail.gmail.com>
@ 2017-01-13 14:59 ` Daniel Shahaf
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2017-01-13 14:59 UTC (permalink / raw)
  To: Timothee Cour; +Cc: Zsh Users

Timothee Cour wrote on Fri, Jan 13, 2017 at 01:15:27 -0800:
> how do i exec while passing OLDPWD?

You could pass it under some other name:

    exec env -i MY_OLDPWD=$OLDPWD zsh

but it's probably easier to do:

    (cd -- "$OLDPWD" && exec env -i NEWPWD=... zsh)

and have the new zsh cd to $NEWPWD.

> related [but for bash]:
> http://unix.stackexchange.com/questions/242909/why-does-bash-clear-oldpwd-when-a-child-script-is-started
>  QUOTE: It seems reasonable to inherit OLDPWD if it names a directory, in
> the same way that the shell inherits PWD if it names the current directory,
> so we'll try that for the next bash version.

Observation: making this change would change the behaviour of `cd -` in
interactive subshells.

What's the use-case for this?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-13 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13  9:15 `exec env -i OLDPWD=$OLDPWD zsh` doesn't work Timothee Cour
     [not found] <CAM4j=kO9MSg-72LWog0N3OPumh8jy_xt4_T_fXEXAKQEk3eoXg__31721.773549407$1484300384$gmane$org@mail.gmail.com>
2017-01-13 14:59 ` Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).