Geoff Clare wrote:
Hugh McIntyre wrote, on 18 May 2007:
Geoff Clare wrote:
(One important issue with the "df -k" output for scripting is that
it adds line breaks in the output for long directory names; that
makes parsing a bit harder)
So use "df -Pk", which outputs one line per file system.
Are you sure?
Actually, after looking at the sources, "-P" has nothing to do with
one-line-per-FS output. Instead, this depends on whether the output is
a TTY (which may please Doug Scott):
/*
* The k_option implies SunOS 4.x compatibility: when the
* special device name is too long the line will be split
* except when the output has been redirected.
* This is also valid for the -h option.
*/
if (use_scaling || k_option || P_option || v_option)
tty_output = isatty(1);
The -P option is specified by POSIX and means "use the POSIX output format".
But not with /bin/df, which makes it less useful for anyone using "df
-Pk" on it's own.
Portable to any POSIX conforming environment. (Which on Solaris
means arranging for /usr/xpg4/bin/df to be used instead of /bin/df)
Presumably, even if project Indiana convinces people to provide
alternate versions of some commands, the /usr/xpg*/bin version will be
unchanged. So they are a bit tangential to this discussion.
Hugh.
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org