Path: utzoo!utgpu!watmath!clyde!att!cbnews!lvc From: lvc@cbnews.ATT.COM (Lawrence V. Cipriani) Newsgroups: comp.unix.questions Subject: Re: correct isatty usage Summary: test Message-ID: <4319@cbnews.ATT.COM> Date: 24 Feb 89 08:02:36 GMT References: <18432@adm.BRL.MIL> <1161@tikal.Teltone.COM> Organization: AT&T Network Systems Lines: 20 In article <1161@tikal.Teltone.COM>, dave@tikal.Teltone.COM (news) writes: + Now my question is, how would you do this in a script? Either C or Bourne. + In C shell, I have this code, but it doesn't appear to work. + + if ({`test -t 0`}) then + echo -n "==> " + else + echo -n "--> " + endif What you want is (Bourne shell or Korn shell): if [ -t 0 ] then echo stdin is a terminal else echo stdin is not a terminal fi -- Larry Cipriani, att!cbnews!lvc or lvc@cbnews.att.com