[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: arithmetic + > + subshell might not be documented
From: |
Jan Schampera |
Subject: |
Re: arithmetic + > + subshell might not be documented |
Date: |
Thu, 02 Apr 2009 06:28:18 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.19 (X11/20090103) |
jidanni@jidanni.org wrote:
> Might not be documented:
>
> $ cat q
> for i in : :; do :|: > x$((++a)); echo =$a=; done; ls x?; rm x?
> for i in : :; do : > x$((++b)); echo =$b=; done; ls x?; rm x?
> $ bash q
> ==
> ==
> x1
> =1=
> =2=
> x1 x2
>
>
I don't think it's specific to arithmetics.
I rather think the redirection (since it's part of the simple command,
not the pipeline) happens in the subshell. The side effects affect the
arithmetics, of course.
J.
PS: I don't know if that's worth to document, I would have epxected that
behaviour. But I may be wrong anyways.