Shawn Walker schrieb:
On 19/05/07, Daniel Rock <[EMAIL PROTECTED]> wrote:

Compatible formatting if stdout is not a terminal.
Optimized formatting if stdout is a terminal.

Which would be really annoying to me as a user.

I would go to look at the output, think "I'll just pipe that to such
and such command" and then wonder why my parsing wasn't working...

So how many scripts of yours failed in the past?


% df -k
[...]
/usr/lib/libc/libc_hwcap2.so.1
                     12395698 7271171 5000571    60%    /lib/libc.so.1

(output wrapped in two lines)

% df -k | cat
[...]
/usr/lib/libc/libc_hwcap2.so.1 12395698 7271171 5000571  60%  /lib/libc.so.1

(output in a single line)


% ls /var
adm         cron        ldap        news        run         statmon
apache      dmi         lib         nfs         sadm        svc
[...]

(multiple columns)

% ls /var | cat
adm
apache
apache2
appserver
[...]

(single column)


etc. etc.


You really shouldn't cut output by column number but by field number. And please don't forget to set LC_ALL=C in your scripts. I have seen lots of scripts which couldn't interpret the real size of "verfügbar" disk space while trying to parse a "df -k" output.


Daniel
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to