$ cat test.sh #!/bin/sh perl -le 'print "Interactive" if -t' perl -le 'print "Batch" unless -t' $ sh test.sh Interactive $ sh test.sh