[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arithmetic expansion with increments and output redirection
From: |
Robert Elz |
Subject: |
Re: Arithmetic expansion with increments and output redirection |
Date: |
Wed, 24 Apr 2019 15:59:37 +0700 |
Date: Tue, 23 Apr 2019 15:49:18 -0600
From: Ian Neal <wopr@wopr.tech>
Message-ID:
<CADBEB3qA0J1-j=iO5t_63h-Ksea1h6YGRnuU=1_Z7uy+7rvycw@mail.gmail.com>
| When using arithmetic expansion with variable pre- and
| post-increments/decrements in the output redirection file path,
| specifically on external executables (not builtins or functions), the state
| of the variable being incremented/decremented is not persisted in the
| environment.
That is as it should be, redirects are eveluated in the sub-shell
context. If anything the bug you showed is that redirects when the
shell does not fork are being evaluated in the context of the shell
(but I think that might be an unspecified case).
In general it is best not to even consider using any evaluation with
side effects in any redirection, and unless you really consider what
you're doing, not in var-assigns either (there, if you're not expecting
the side effects to be visible in the same, or any other, assignemnt
in the same command you should be OK).
kre
- Arithmetic expansion with increments and output redirection, Ian Neal, 2019/04/23
- Re: Arithmetic expansion with increments and output redirection,
Robert Elz <=
- 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, 2019/04/24
- Re: Arithmetic expansion with increments and output redirection, Greg Wooledge, 2019/04/24