How to determine if the output is screen or pipe.


/ Published in: Perl
Save to your folder(s)



Copy this code and paste it in your HTML
  1. sub isOutputScreen {
  2.  
  3.   use POSIX;
  4.  
  5.   return 0 if POSIX::isatty( \*STDOUT) eq "" ; # pipe
  6.   return 1; # screen
  7. } # end of isOutputScreen

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.