How does the ksh ENV "trick" work?

Eric Halil eric at brolga.cc.uq.oz.au
Mon May 27 15:44:51 AEST 1991


In "The Kornshell Command and Programming Language" by Morris I. Bolsky and
David G. Korn, Prentice-Hall, 1989, ISBN 0-13-516972-0, page 78 they give:

  export FILE=$HOME/.kshrc
  # The subscript below evaluates to 0 when interactive.
  ENV='${FILE[(_$-=0)+(_=1)-_${-%%*i*}]}'

as a easy way to stop your .kshrc being evaluated when it's an not an
interactive shell.  Can someone explain in detail how this works? 

Thanks,
Eric (eric at cc.uq.oz.au)



More information about the Comp.unix.shell mailing list