HOW do you tell KSH is interactive ?
Brandon S. Allbery KB8JRR
allbery at NCoast.ORG
Tue Feb 26 15:31:31 AEST 1991
As quoted from <5864 at iron6.UUCP> by yeates at motcid.UUCP (Tony J Yeates):
+---------------
| asg at sage.cc.purdue.edu (The Grand Master) writes:
| >In article <1991Feb18.070424.6054 at noose.ecn.purdue.edu> you write:
| >> Certainly I don't want
| >>the aliases or something to executed for non-interactive shell, i.e.
| >>the shell spawned to interprete the ksh-scripts.
|
| Starting ksh scripts with the the -p option in your shell scripts might help,
| on Sun we use the first line:-
+---------------
case "x$-" in
x*i*)
# interactive
;;
*) # non-interactive
;;
esac
This has the advantage over [[ ]] that, should it be necessary, this is also
legal Bourne shell syntax. (Why would you need this in Bourne shell? For
"scripts" that you "." (that's "source" for you csh-noids :-) from interactive
and non-interactive shells and need different behavior from each.)
++Brandon
--
Me: Brandon S. Allbery VHF/UHF: KB8JRR on 220, 2m, 440
Internet: allbery at NCoast.ORG Packet: KB8JRR @ WA8BXN
America OnLine: KB8JRR AMPR: KB8JRR.AmPR.ORG [44.70.4.88]
uunet!usenet.ins.cwru.edu!ncoast!allbery Delphi: ALLBERY
More information about the Comp.unix.shell
mailing list