home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / shell / 4785 < prev    next >
Encoding:
Text File  |  1992-11-19  |  1.2 KB  |  33 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!coplex!trebor!root
  3. From: root@trebor.uucp (Bob Stockler)
  4. Subject: Re: Am I writing to a tty or pipe?
  5. Organization: Bob Stockler
  6. Date: Wed, 18 Nov 1992 01:53:35 GMT
  7. Message-ID: <1992Nov18.015335.14478@trebor.uucp>
  8. References: <228@dinowine.huber.com> <Bxovv9.MBu@ddsw1.mcs.com> <229@dinowine.huber.com>
  9. Lines: 22
  10.  
  11. eddjp@huber.com (Dewey Paciaffi) writes:
  12.  
  13. >In article <Bxovv9.MBu@ddsw1.mcs.com>, dattier@ddsw1.mcs.com (DWT) writes:
  14. >|> eddjp@dinowine.huber.com (Dewey Paciaffi) wrote in <228@dinowine.huber.com>:
  15. >|> 
  16. >|> | Is there a way to determine from within a Bourne shell script if
  17. >|> | the output is being written to a tty or a pipe?
  18. >|> 
  19. >|> test -t 
  20. >|> 
  21. >|> or were you thinking of something that test -t doesn't answer?
  22. >|> 
  23. >|> David W. Tamkin   Box 59297   Northtown Station, Illinois  60659-0297
  24. >|> dattier@ddsw1.mcs.com    CompuServe: 73720,1570    MCI Mail: 426-1818
  25.  
  26. >That's exactly what I was looking for. Thanks to all who responded.
  27.  
  28. It may have been what you were looking for, but it's not what you asked.
  29.  
  30. The "test -t" tells if the file descriptor argument to it is a tty or not,
  31. but not if it is a pipe (or file or device or whatever).
  32.  
  33.