perl -e " print -t STDIN ? qq(STDIN has tty) : qq(NO tty associated);print ' - '; print -p STDIN ? qq(STDIN is a pipe or a named pipe) : qq(NOT a pipe)" #out #STDIN has tty - NOT a pipe hostname | perl -e " print -t STDIN ? qq(STDIN has tty) : qq(NO tty associated);print ' - '; print -p STDIN ? qq(STDIN is a pipe or a named pipe) : qq(NOT a pipe)" #out #NO tty associated - STDIN is a pipe or anamed pipe