Gregory Stark wrote:
>
> [Just when I thought I was out, they pull me back in -- argh, I'm weak]
>
> "Bruce Momjian" <bruce@momjian.us> writes:
>
> > FYI, ls -C actually wraps to 72(?) unless you specify another width,
>
> I told you exactly what ls did, at least GNU ls. It uses -w if specified, if
> not then it uses the ioctl if that succeeds, if it fails it uses COLUMNS, and
> if that's unavailable it uses a constant.
> $ COLUMNS=40 ls -C | cat
> distmp3.rh3280 purpleNMN49T
> gconfd-stark ssh-WdHPsk4277
> orbit-stark
I don't see that behavior here on Ubuntu 7.10:
$ COLUMNNS=120 ls -C |catarchive cd initrd lost+found proc srv usrbasement.usr dev initrd.img
media root sys varbin etc laptop mnt rtmp tmp vmlinuzboot home lib
opt sbin u win$ ls --versionls (GNU coreutils) 5.97
That is not a 120 width. 'ls' seems to ignore columns for pipe output.
> > That might make the "I want it always to wrap" group happier, but not the
> > "wrapped shouldn't affect file/pipe". I have not heard anyone explain why
> > the later behavior is bad, especially if we default to a width of 72 rather
> > than the screen width.
>
> Presumably they're concerned that scripts which dump out data and then try to
> parse it will have trouble parsing wrapped output. In any case that should be
> based on whether isatty() is true, which is related to but not the same as
> whether the window size ioctl succeeds.
Right now we honor $COLUMNS only when isatty() is true.
-- Bruce Momjian <bruce@momjian.us> http://momjian.us EnterpriseDB
http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +