[sf-lug] dpkg -l & width ...

Michael Paoli Michael.Paoli at cal.berkeley.edu
Wed Aug 2 07:30:06 PDT 2017


> From: "Rick Moen" <rick at linuxmafia.com>
> Subject: Re: [sf-lug] NEED INFO ABOUT BOOT SECTOR, SPACE LIMITS
> Date: Tue, 1 Aug 2017 10:51:28 -0700

> Quoting Daniel Gimpelevich (daniel at gimpelevich.san-francisco.ca.us):
>
>> In the steps I gave, I piped dpkg -l through cat because it apparently
>> detects the number of columns from the tty that is stdout, and not from
>> a pipe, e.g. to less or cat.
>
> Well, OK, but in my experience, 'dpkg -l | less' works just great
> provided you run it in a terminal 80 columns (or more) wide, so my point
> to Alex is that I'm puzzled he perceives a problem he needs scripting to
> solve.
>
> No special steps should be required at all, is my point.  Just have an
> adequately wide terminal, nothing more.  If there's a problem you see,
> then maybe your terminal is screwed up and you should be fixing _that_
> instead.

Hmmm, I seem to get the behavior Daniel observes.
Rick, perhaps you have COLUMNS in your typical environment,
and Daniel and I don't?
As far as I can easily tell, dpkg -l will use COLUMNS if it's set
in the environment (but if it's set to less than 80 it seems to treat
it as if it was set to 80), and if COLUMNS is not set and if stdout
isatty(3), will try to determine and use width of the tty.
Or, Rick, perhaps you have some other environmental or version difference
that gives slightly different behavior?




More information about the sf-lug mailing list