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

Chet Ramey chet.ramey at case.edu
Fri Apr 24 08:55:38 PDT 2020


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.

I tested on Mac OS using bash-5.0 and bash-4.4. I'm not really interested
in testing versions before that.

-- 
``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