[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arithmetic expansion with increments and output redirection
From: |
Chet Ramey |
Subject: |
Re: Arithmetic expansion with increments and output redirection |
Date: |
Wed, 24 Apr 2019 09:58:42 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 4/24/19 9:49 AM, Ilkka Virta wrote:
> On 24.4. 16:37, Chet Ramey wrote:
>> "Utilities other than the special built-ins (see Special Built-In
>> Utilities) shall be invoked in a separate environment that consists of the
>> following...[includes redirections specified to the utility]...
>
> It does say
>
> "Open files inherited on invocation of the shell, open files controlled by
> the exec special built-in plus any modifications, and additions specified
> by any redirections to the utility"
>
> which could also be read to apply only the open files themselves, not the
> byproducts of finding out their names.
I think the POSIX language is crafted to allow both behaviors, and bash
has always interpreted it to process redirections, including the expansions
performed on the word, in the subshell forked to execute the command.
> Anyway, as little as it's worth, Zsh seems to do it the same way Bash does,
> all others leave the changed value visible.
The SVR4.2 Bourne shell, as another data point, behaves like bash. Since
it doesn't have arithmetic expansion, you have to use something it does
handle internally, like ${n:=2}. I don't know what ksh88, the other POSIX
historical reference implementation, does.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
- Arithmetic expansion with increments and output redirection, Ian Neal, 2019/04/23
- Re: Arithmetic expansion with increments and output redirection, Robert Elz, 2019/04/24
- Re: Arithmetic expansion with increments and output redirection, Chet Ramey, 2019/04/24
- Re: Arithmetic expansion with increments and output redirection, Ian Neal, 2019/04/24
- Re: Arithmetic expansion with increments and output redirection, Chet Ramey, 2019/04/24
- Re: Arithmetic expansion with increments and output redirection, Ilkka Virta, 2019/04/24
- Re: Arithmetic expansion with increments and output redirection,
Chet Ramey <=
- Re: Arithmetic expansion with increments and output redirection, Greg Wooledge, 2019/04/24
- Re: Arithmetic expansion with increments and output redirection, Ian Neal, 2019/04/24
- Re: Arithmetic expansion with increments and output redirection, Chet Ramey, 2019/04/24
Re: Arithmetic expansion with increments and output redirection, Chet Ramey, 2019/04/24