Re: forked before bash subshell

2016-10-13 Thread Daniel Colascione
On 10/13/2016 08:05 PM, Bob Proulx wrote: XiaoBing Jiang wrote: Greg Wooledge wrote: If you want to ENSURE that the child shell process is replaced by the external sleep 20, use an explicit exec. yes, I want to know why bash not optimize this. or any strategy ? Because it wouldn't save

Re: forked before bash subshell

2016-10-13 Thread Bob Proulx
XiaoBing Jiang wrote: > Greg Wooledge wrote: > > If you want to ENSURE that the child shell process is replaced by the > > external sleep 20, use an explicit exec. > > yes, I want to know why bash not optimize this. or any strategy ? Because it wouldn't save anything significant. Since the

Re: The "-e" test ingores broken links

2016-10-13 Thread Peter & Kelly Passchier
WHich docs? If I do "help test" it states: "All file operators except -h and -L are acting on the target of a symbolic link, not on the symlink itself, if FILE is a symbolic link." Peter On 14/10/2559 02:00, Łukasz Grabowski wrote: > Configuration Information [Automatically generated, do not

The "-e" test ingores broken links

2016-10-13 Thread Łukasz Grabowski
Configuration Information [Automatically generated, do not change]: Machine: i586 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i586' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale'

Re: forked before bash subshell

2016-10-13 Thread XiaoBing Jiang
On Wed, Oct 12, 2016 at 8:23 PM, Greg Wooledge wrote: > On Tue, Oct 11, 2016 at 07:14:24PM -0700, s7v7nisla...@gmail.com wrote: > > why bash bahavior like this? is that a bug? > > > > if not, why should forked before execute subshell? > > Because that's how subshells work.

Re: BASH_SUBSHELL reset to 0 on EXIT trap in aubshell

2016-10-13 Thread Martijn Dekker
Also, perhaps BASH_SUBSHELL should be a readonly like BASHPID is. - M.

BASH_SUBSHELL reset to 0 on EXIT trap in aubshell

2016-10-13 Thread Martijn Dekker
bash resets BASH_SUBSHELL to 0 when executing an EXIT trap, even if the EXIT trap is executed in a subshell. echo $(trap 'echo $BASH_SUBSHELL' EXIT; echo $BASH_SUBSHELL) Actual output: 1 0 Expected output: 1 1 The same does not happen for a signal trap. echo $(trap 'echo $BASH_SUBSHELL; exit'