bug-bash
[Top][All Lists]
Advanced

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

Re: set -a leads to truncated output from ps


From: Koichi Murase
Subject: Re: set -a leads to truncated output from ps
Date: Sat, 15 Jun 2024 22:48:22 +0900

2024年6月15日(土) 13:48 Oğuz <[email protected]>:
> On Saturday, June 15, 2024, Koichi Murase <[email protected]> wrote:
>> Also, the behavior of the `ps' command honoring COLUMNS to format its
>> output is also an expected one.
>
> The fact that programs giving precedence to COLUMNS over the
> terminal API are so common is an argument against exporting COLUMNS
> behind the user's back though.

I'm not sure how it is against exporting COLUMNS. I agree that it may
cause unexpected behaviors when a user or a script uses the utilities
using COLUMNS in the wrong way, but the existence of the programs
using COLUMNS implies that those programs expect the users to export
it when the user likes to do it. If those programs would not expect
COLUMNS to be exported, why do these programs read the environment
variable COLUMNS in the first place?

> Right now, if you're dealing with such a program while `set -a' is in effect,

Is this a reply to me? My argument was that the script is still broken
even when the user does *not* use `set -a'. Or you repeat the
arguments to the general audience.

> in order to suppress COLUMNS you need to unexport it before every command:

In Bash, when you know you are going to use programs honoring COLUMNS
and you want to disable that, you can just run `shopt -u checkwinsize'
and `unset -v COLUMNS' only once at the beginning of the script.

However, for the portable scripts, I now agree that it is a problem
that Bash seems to enable `checkwinsize' even in the POSIX mode.

--
Koichi



reply via email to

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