[Top][All Lists]

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

Re: Pipe using subshells, variables not saved

From: Misaki
Subject: Re: Pipe using subshells, variables not saved
Date: Mon, 6 Mar 2017 11:44:26 -0800

On Sat, Mar 4, 2017 at 10:12 AM, Chet Ramey <address@hidden> wrote:
On 3/4/17 1:04 AM, Misaki wrote:
> Variables are not saved when using a pipe because both sides are in a
> subshell environment.

If you want this to happen, enable the `lastpipe' shell option.

Thank you. My standpoint is 'whatever makes things easier for new users', I definitely don't have detailed knowledge of design decisions. But I see this: http://unix.stackexchange.com/questions/143958/in-bash-read-after-a-pipe-is-not-setting-values

Someone says that not using a subshell for pipelines is POSIX-compliant. Even if bash does use a subshell, is there a reason why lastpipe also requires job execution to be off (with 'set -m')?

reply via email to

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