if (-t STDIN) { # we're running from a shell, without input being # piped to us. } else { # ... }