On Thu, May 17, 2007 at 03:08:22PM +0700, Doug Scott wrote:

> The patch for df.c below checks to see if stdout is a tty (i.e. interactive), 
> and will add
> the -h option if no other options conflict. If stdout is not a tty (i.e. a 
> script), the df command
> is unchanged. Is there anything wrong with this idea??

isatty() has nothing to do with whether a command was run interactively.
It simply says whether a file descriptor is attached to a terminal.  So
with your change typing "df > out" or "df | less" wouldn't have the -h flag
added.  But running a script from the commandline with plain "df" in it
would still have stdout attached to the terminal, and would have the -h
flag added.

Maybe there's something you can do if you're running from a modern shell
that looks at process groups or sessions, but I'm not sure.

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

Reply via email to