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

Re: Getting wide ``dpkg -l'' output in scripts and pipes.



On Tue, May 18, 2004 at 11:40:53AM +0000, Adam Funk wrote:
> On Tuesday 18 May 2004 10:20, Thomas Adam wrote:
> >  --- Adam Funk <a24061@yahoo.com> wrote:
> >> (Sorry about the long lines but they illustrate the output I'm
> >>  talking about.)
> >> 
> >> ``dpkg -l'' on its own in a terminal produces wide output, e.g.:
> > 
> > COLUMNS=200 dpkg -l | pipe | pipe | pipe | more | more | yay
> > 
> > Change the value of 200, if it is too small.
> 
> Excellent.  I had tried these:
> 
> (COLUMNS=200 ; dpkg -l) |head
> (COLUMNS=200 && dpkg -l) |head
> 
> but got the narrow output.  Why do these two fail?

Those both set the COLUMNS shell variable but fail to export it to the
dpkg subprocess (you need an explicit 'export' to do that). 'COLUMNS=200
dpkg -l' is a special syntax that adds the variable to the environment
of the dpkg subprocess without affecting the shell in which it is
executed.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: