When I uss less file1 file2 I get both files shown in the "less buffer viewer", but less file1 file2 | cat prints the content of both files appended to stdout. How does less know if it should show the "less buffer viewer" or produce output to stdout for a next command? What mechanism is used for doing this?
|
|
||||
|
|
|
There is a C function called "isatty" which checks for its output is writing to a tty. In Bash you can use test (see
something like that
|
|||||
|