Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!usc!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!gatech!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) Newsgroups: comp.unix.shell Subject: Re: HOW do you tell KSH is interactive ? Message-ID: <1991Feb26.043131.8429@NCoast.ORG> Date: 26 Feb 91 04:31:31 GMT References: <1991Feb18.070424.6054@noose.ecn.purdue.edu> <6178@mentor.cc.purdue.edu> <5864@iron6.UUCP> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) Followup-To: comp.unix.shell Organization: North Coast Public Access Un*x (ncoast) Lines: 31 As quoted from <5864@iron6.UUCP> by yeates@motcid.UUCP (Tony J Yeates): +--------------- | asg@sage.cc.purdue.edu (The Grand Master) writes: | >In article <1991Feb18.070424.6054@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@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 Brought to you by Super Global Mega Corp .com