bug-bash
[Top][All Lists]
Advanced

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

Re: unexpected behavior with read


From: Greg Wooledge
Subject: Re: unexpected behavior with read
Date: Mon, 5 Mar 2018 10:06:20 -0500
User-agent: NeoMutt/20170113 (1.7.2)

On Sun, Mar 04, 2018 at 06:15:05PM -0500, Zach Hadgraft wrote:
> Description:
>         global variable assignments fail when part of a sequence that
> includes read and begins with a function invoked by command substitution
>         read can be invoked by another function, or invoked by another
> command and the result is the same

As Chet said, command substitution runs in a subshell, which means
side effects (global variable changes, changing directory, etc.) are
discarded.

If your actual goal is to send information from a function back to the
caller, please see <https://mywiki.wooledge.org/BashFAQ/084>.



reply via email to

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