bug-bash
[Top][All Lists]
Advanced

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

Re: Bash bug in variable assignment/echo/grep -q


From: Chet Ramey
Subject: Re: Bash bug in variable assignment/echo/grep -q
Date: Tue, 21 Jun 2016 22:21:01 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 6/21/16 9:35 PM, Roel Van de Paar wrote:

> Bash Version: 4.2
> Patch Level: 46
> Release Status: release
> 
> Description:
>         DONE=0 at the end of the 'Repeat-By' script - should be 1 ?
> 
> Repeat-By:
>         LINE='test'; DONE=0; echo ${LINE} | if grep -q 'test'; then DONE=1;
> echo "DONE"; fi; echo $DONE

All elements of a pipeline are executed in subshells.  A subshell cannot
affect its parent's environment.  The `lastpipe' shell option can change
this when job control is not active.
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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