HOW do you tell KSH is interactive ?

Bernd Felsche bernie at metapro.DIALix.oz.au
Tue Mar 5 13:56:46 AEST 1991


In <1991Feb28.183809.23891 at noose.ecn.purdue.edu> luj at gus17.ecn.purdue.edu
  (Jun Lu) writes:

>In article <1991Feb26.041034.15149 at metapro.DIALix.oz.au> bernie at metapro.DIALix.oz.au (Bernd Felsche) writes:
>>You could test to see if stdin is connceted to a tty!
>>
>>[ -t 0 ] && echo interactive

>Incorrect. You can easily see this by putting this line in a script file.

Now, if I hadn't tried it, I wouldn't have suggested it! It works for
me, and has worked interactively, and via a script. Now, if your
standard input is altered, even by you putting the script in
background (making it non-interactive) then the message won't be
printed.

Maybe you have a broken ksh? The one I have came with SVR3.2/68k
from Motorola. As a matter of fact, it even works with the Bourne
shell we have (as it should, because it's a standard test function).

Can you tell me what I'm doing right? :-)
-- 
Bernd Felsche,                 _--_|\   #include <std/disclaimer.h>
Metapro Systems,              / sale \  Fax:   +61 9 472 3337
328 Albany Highway,           \_.--._/  Phone: +61 9 362 9355
Victoria Park,  Western Australia   v   Email: bernie at metapro.DIALix.oz.au



More information about the Comp.unix.shell mailing list