title: How can I detect if my shell script is running through a pipe?
body: <p>How do I detect from within a shell script if its standard output is being sent to a terminal or if it's piped to another process?</p>
  <p>The case in point: I'd like to add escape codes to colorize output, but only when run interactively, but not when piped, similar to what <code>ls --color</code> does.</p>