bug-bash
[Top][All Lists]
Advanced

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

Re: Arithmetic expansion with increments and output redirection


From: Ian Neal
Subject: Re: Arithmetic expansion with increments and output redirection
Date: Wed, 24 Apr 2019 07:22:18 -0600

On Wed, Apr 24, 2019, 07:12 Chet Ramey <chet.ramey@case.edu> wrote:

> On 4/24/19 8:47 AM, Ian Neal wrote:
>
> > At what point is a subshell being invoked? There's no pipeline, command
> > substitution, coprocess, background process, or explicit () subshell
> here,
> > which are the only cases a subshell should be created. Otherwise, the
> > entire operation should be evaluated by the main shell. Arithmetic
> > expansion is not in that list.
>
> Why would you think that /bin/true would be "evaluated by the main shell?"
> It's not a shell compound command or a builtin, and non-builtin commands
> are run in child processes.
>

Calling what should be a simple fork(); exec(); a "subshell" is a little
disingenuous unless it has its own parameter expansion options, which isn't
true -- if the $((n++)) was on the left side of the file redirection (which
is to say a parameter), it would be expanded by the shell before the
fork(), so why is this true with the redirection itself? What makes that
case so special? I posit that it shouldn't be.

>


reply via email to

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