Re: it, soRE: set -a leads to truncated output from ps
From:
Greg Wooledge
Subject:
Re: it, soRE: set -a leads to truncated output from ps
Date:
Thu, 13 Jun 2024 14:42:32 -0400
On Thu, Jun 13, 2024 at 06:28:23PM +0000, Alain BROSSARD via Bug reports for
the GNU Bourne Again SHell wrote:
> My conclusion is that the variable COLUMNS gets “reset” when there is a
> pipe in a command and further gets EXPORTED if “set -a” was set before hand :
>
> host:/$ COLUMNS=80
> host:/$ echo $COLUMNS
> 80
> host:/$ echo $COLUMNS
> 80
> host:/$ echo $COLUMNS | cat
> 80
> host:/$ echo $COLUMNS
> 102
OK, that's interesting. I can confirm this in Debian's bash 5.2.15:
hobbit:~$ bash
hobbit:~$ set -a
hobbit:~$ env | grep COLUMN
hobbit:~$ true | false
hobbit:~$ env | grep COLUMN
COLUMNS=80
hobbit:~$ echo $BASH_VERSION
5.2.15(1)-release
I did not move or resize the window at any time during this test.
The same thing happens in a compiled upstream 5.2.26:
hobbit:~$ bash-5.2.26
hobbit:~$ set -a
hobbit:~$ env | grep COLUMN
hobbit:~$ env | grep COLUMN
COLUMNS=80
Again, I did not move or resize this window during this test. It is an
80x24 rxvt-unicode terminal, about as plain as you can get. I get the
same result in an xterm also.
I still have no idea why you're running set -a in an interactive shell.