home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / shell / 4680 < prev    next >
Encoding:
Text File  |  1992-11-13  |  620 b   |  28 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!psgrain!neon!jeff
  3. From: jeff@neon.rain.com (Jeff Beadles)
  4. Subject: Re: Am I writing to a tty or pipe?
  5. Message-ID: <BxnsIA.EGK@neon.rain.com>
  6. Reply-To: jeff@onion.rain.com (Jeff Beadles)
  7. References: <228@dinowine.huber.com>
  8. Date: Fri, 13 Nov 1992 14:34:56 GMT
  9. Lines: 17
  10.  
  11. eddjp@dinowine.huber.com (Dewey Paciaffi) writes:
  12.  
  13. >Is there a way to determine from within a Bourne shell script if
  14. >the output is being written to a tty or a pipe?
  15.  
  16.  
  17. By example:
  18.  
  19. if [ -t 1 ] ; then
  20.     echo "Stdout is a tty"
  21. else
  22.     echo "Stdout is a pipe"
  23. fi
  24.  
  25.     -Jeff
  26. -- 
  27. Jeff Beadles        jeff@onion.rain.com
  28.