in reply to Re: How do I Determine if my script is being piped to?
in thread How do I Determine if my script is being piped to?
Thanks much for the reply. I didn't expect an answer so fast or that it would provide the solution.
Though the example you gave doesn't work, maybe because of 'use strict;' , I did find a couple things that do work. If I did have a better understanding of Linux, I may have found the answer on my own. Just something I'll have to work on.
Here are a couple examples of what did work for me:use strict; if ( -t STDIN ) { print "This is what you're supposed to do ...\n"; exit; } # or use POSIX qw(isatty); if ( isatty(\*STDIN) ) { print "This is what you're supposed to do ...\n"; exit; } while (<STDIN>) { print STDOUT "Add something to STDOUT".$_; }
|
|---|