in reply to How do I find out if STDIN or STDOUT are attached to a pipe?
Just to expand slightly on merlyn's answer. When you run a script interactively, its STDOUT is attached to a 'TTY', so -t STDOUT would be true.
When you pipe the output through a pager or redirect it to a file, the -t test would return false. But because a plain file is not a pipe, -p would return false. So in real life, '! -t' is probably used more than '-p'.
|
|---|