On Thu, Jun 13, 2024 at 06:12:21PM +0200, Andreas Schwab wrote: > Why do you think this is a bug in bash? You are telling the shell to > export any modified variable, and you get what you asked for.
I started writing something like this as well but deleted it. I think there's still a bit of subtlety to be worked out here with respect to the COLUMNS variable. If checkwinsize is enabled (which seems to be the default), perhaps this is somehow causing COLUMNS to be added to the set of modified variables and exported after running "set -a" in an interactive shell? In my own testing just now, running "set -a" in an interactive shell doesn't cause COLUMNS to be exported *until* I resize the window. If I resize the window after "set -a", then COLUMNS does indeed get exported. It's not clear to me whether that's intended or desired. It would be useful to know exactly what steps the OP has performed to produce the undesired outcome, including the moving and resizing of terminal windows. (Then again, running set -a in an interactive shell seems like a fairly peculiar thing to do. It might be helpful to know why that was done. I won't hold my breath waiting for explanations, though.)