[cs631apue] Midterm Question

Jan Schaumann jschauma at stevens.edu
Sat Sep 22 11:39:02 EDT 2012


jphillip <jphillip at stevens.edu> wrote:
> In the man page for 'ls' I sometimes see the phrase 'This is the default 
> when output is not to a terminal.'
>
> I am confused by this because I thought ls always printed to standard  
> output so why would this need to be stated?

Standard out is different from "to a terminal".  Standard out may be
connected to a terminal:

ls

Standard out may be connected to a pipe:

ls | more

Standard out may be connected to a file:

ls >file


Take a look at isatty(3), which may be helpful here.

-Jan


More information about the cs631apue mailing list