bug-bash
[Top][All Lists]
Advanced

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

Arithmetic expansion with increments and output redirection


From: Ian Neal
Subject: Arithmetic expansion with increments and output redirection
Date: Tue, 23 Apr 2019 15:49:18 -0600

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic
uname output: Linux s1028505 3.10.0-957.10.1.el7.x86_64 #1 SMP Thu Feb 7
07:12:53 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.2
Patch Level: 46
Release Status: release

Description:
    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.

Repeat-By:
    # n=1; true > $((--n)); echo $n; ls
    outputs:
      0
      0
    but
    # n=1; /bin/true > $((--n)); echo $n; ls
    outputs:
      1
      0


reply via email to

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