How to prevent execution of $ENV file in Korn shell scripts ?

Pim Zandbergen pim at cti-software.nl
Fri Oct 5 06:38:33 AEST 1990


golder at nwnexus.WA.COM (Warren Jones) writes:

>A related question:  When working on an HP-UX system a while back,
>I remember seeing in one of the manuals a trick for defining ENV
>so that the variable expands to the desired file name for interactive
>shells, but to a null string if the shell is not interactive.

>NOTE:  this is a different question, and does involve efficiency
>(though I'm sure not in any critical way).  After all, you don't
>need to read the ENV file when the shell is simply being used
>to glob some file names for an editor.  The trick involved checking
>the "$-" flags variable for the presence of the letter "i"
>(indicating an interactive shell).  I remember marveling at the
>time how wonderfully obscure and arcane it was, but I can't quite
>seem to reproduce it.  Can anyone out there provide the answer?

[[ ${-} = *i* ]] || ENV=
-- 
Pim Zandbergen                          domain : pim at cti-software.nl
CTI Software BV                         uucp   : uunet!mcsun!hp4nl!ctisbv!pim
Laan Copes van Cattenburch 70           phone  : +31 70 3542302
2585 GD The Hague, The Netherlands      fax    : +31 70 3512837



More information about the Comp.unix.questions mailing list