[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: forked before bash subshell
From: |
Chet Ramey |
Subject: |
Re: forked before bash subshell |
Date: |
Sat, 15 Oct 2016 22:03:08 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 10/11/16 10:14 PM, s7v7nislands@gmail.com wrote:
> 1. the script to reproduce
> bash-4.4$ cat t.sh
> (cd /tmp && sleep 20) &
>
> echo "end"
>
>
> 2. run it
> bash-4.4$ bash t.sh
> end
>
> 3. script end, but there is a new forked script.
> bash-4.4$ ps -ef | grep t.sh
> 501 50268 1 0 10:09AM ttys015 0:00.00 bash t.sh
> 501 50275 50181 0 10:10AM ttys015 0:00.00 grep t.sh
>
>
>
> question:
> when using sh -> dash, It will not fork before subshell, what's the different?
>
> why bash bahavior like this? is that a bug?
It's not a bug; it's an opportunity for optimization. It's like this
because it hasn't come up as a performance problem. I'll take a look
at it. There are probably several opportunities like this.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- forked before bash subshell, s7v7nislands, 2016/10/11
- Re: forked before bash subshell, Greg Wooledge, 2016/10/12
- Re: forked before bash subshell, XiaoBing Jiang, 2016/10/13
- Re: forked before bash subshell, Bob Proulx, 2016/10/13
- Re: forked before bash subshell, Daniel Colascione, 2016/10/13
- Re: forked before bash subshell, L. A. Walsh, 2016/10/15
- Re: forked before bash subshell, Daniel Colascione, 2016/10/15
- Re: forked before bash subshell, L. A. Walsh, 2016/10/15
- Re: forked before bash subshell, L. A. Walsh, 2016/10/15
Re: forked before bash subshell,
Chet Ramey <=