Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!news.wildstar.net!news.ececs.uc.edu!news.kei.com!newsfeed.internetmci.com!EU.net!usenet2.news.uk.psi.net!uknet!usenet1.news.uk.psi.net!uknet!dispatch.news.demon.net!demon!awfulhak.demon.co.uk!awfulhak.demon.co.uk!awfulhak.demon.co.uk!not-for-mail From: brian@anorak.coverform.lan (Brian Somers) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Serious brain damage in /bin/sh for FreeBSD 2.1.5 Date: 3 Dec 1996 01:31:11 -0000 Organization: Coverform Ltd. Lines: 41 Sender: brian@awfulhak.demon.co.uk Message-ID: <57vvsv$2oh@anorak.coverform.lan> References: <stanbE1M2D2.38I@netcom.com> <stanbE1Mw49.41q@netcom.com> <57p5ad$jmv@ns.qnis.net> <stanbE1puHB.E20@netcom.com> Reply-To: brian%anorak.coverform.lan@awfulhak.demon.co.uk NNTP-Posting-Host: localhost.coverform.lan X-NNTP-Posting-Host: awfulhak.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Newsreader: knews 0.9.8 In article <stanbE1puHB.E20@netcom.com>, stanb@netcom.com (Stan Brown) writes: [.....] : Here are thisng that *won't* work. : : 1. checking $SHELL (/bin/sh doesn't change the value of this). : : 2. checking $0 (this won't work since this will be the scripts name : not /bin/sh). : : 3. unseting $ENV at the end of the $ENV file. : : These are the only things I can tink of to try. None of them work. : : The result of this is that if I set up my shell to be /usr/bin/ksh, and : have my .profile file set $ENV, then all system functions implemented : as shell scripts are broken. : : If anyone has any ideas on how to work around this, I would love to : hear them. Given=ENV ENV= echo $Given | read ENV This will take advantage of the fact that the *real* ksh will inline the last command in a pipe, and only leave ENV set if it's a *real* ksh. However, I would suggest that the line test -n "$ENV" && { ENV= exec $0 "$@"; } be put at the front of scripts that are likely to be run with ENV set. Not only does ENV slow the script down, but it's the best way I've ever seen to break a script. Anyone that writes a script that depends on ENV should be first against the wall when the revolution comes :{} -- Brian <brian%anorak.coverform.lan@awfulhak.demon.co.uk> <http://www.awfulhak.demon.co.uk/> Don't _EVER_ lose your sense of humour.... .