chris@mimsy.UUCP (Chris Torek) (07/02/89)
In article <1798@lgnp1.LS.COM> rbarrell@lgnp1.LS.COM (Robert Barrell) writes: > if [ `tty -s;echo $?` = 0 ] This is rather the hard way around: a simple if tty -s will suffice. The result of if list; then true-branch; else false-branch; fi is `true' if the exit status (here, `$?') of the command-list `list' is zero, and false otherwise, so that the `if' runs the true-branch if `tty -s' exits 0 and the false-branch if `tty -s' exits nonzero (1). To get this effect in the C shell, one must write if { tty -s } then (`if ({ list }) then' is also accepted). Watch the spacing; the words `if' and `then' must not be run into their parentheses or braces. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris