[Toybox] Would someone please explain what bash is doing here?

Chet Ramey chet.ramey at case.edu
Fri Apr 24 12:26:54 PDT 2020


On 4/24/20 3:07 PM, Rob Landley wrote:
> 
> 
> On 4/24/20 10:55 AM, Chet Ramey wrote:
>> On 4/24/20 9:48 AM, Rob Landley wrote:
>>> Try this in bash, and hit ctrl-Z before it returns:
>>>
>>>   /bin/echo $(ls /usr/bin; sleep 5)
>>>
>>> Now try to get your terminal back. (Prompt doesn't come back, timeout doesn't
>>> happen, ctrl-c doesn't work...)
>>
>> It has no effect. The command substitution isn't a job, and it's in the
>> same process group as the parent shell (as is the terminal). It's run by
>> the parent before it forks to run /bin/echo.
>>
>> Hitting ^C kills it.
> 
> Yes and no:
> 
>   $ /bin/echo $(sleep 5)
>   ^Z^C
>   $ /bin/echo $(ls /usr/bin; sleep 5)
>   ^Z^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C

Jeez, I hope this isn't another Linux-specific condition I'll have to work
around. This doesn't happen on Mac OS X.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet at case.edu    http://tiswww.cwru.edu/~chet/



More information about the Toybox mailing list