in reply to How do I Determine if my script is being piped to?

IIRC, there is in fact a way to tell if STDIN is connected to a tty. It might be a *nix system call. In fact, I recall doing this myself many, many moons ago for basically the same reason you are. I'd have to do some searching myself, but look for how to determine if a process is connected to a terminal instead of how to determine if STDIN is from a pipe, that will probably get you closer to finding an answer.

It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.
  • Comment on Re: How do I Determine if my script is being piped to?