*BSD News Article 84093


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!feed1.news.erols.com!howland.erols.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!pooh!chet
From: chet@pooh.INS.CWRU.Edu (Chet Ramey)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Serious brain damage in /bin/sh for FreeBSD 2.1.5
Date: 2 Dec 1996 20:18:31 GMT
Organization: Case Western Reserve University, Cleveland, Ohio, USA
Lines: 29
Message-ID: <57vdin$f1q@alexander.INS.CWRU.Edu>
References: <stanbE1M2D2.38I@netcom.com>
NNTP-Posting-Host: pooh.ins.cwru.edu

In article <stanbE1M2D2.38I@netcom.com>, Stan Brown <stanb@netcom.com> wrote:

>	Now I have more problems. The scripts assume that *only* ksh will
>source a file pointed to by the $ENV variable. Well geuss what the FreeBSD
>/bin/sh tries to load what is pointed to by the $ENV variablke. It of
>course doesn't like the things in there which are in ksh synatx. No problem
>saya I, I'll just unset $ENV at the end of the .kshrc file (the one pointed
>to by the $ENV). This doesn't fix system scripts that exec /bin/sh with
>#!/bin/sh. OK I think I'll just put a test for $SHELL being set to 
>basname ksh around my .kshrc. Well this doesn't work because when a /bin/sh
>script is invoked from a ksh script /bin/sh doesn;t bother to reset $SHELL
>(NOTE chs does reset this).
>
>	I realize all Berkley centric people think the workd revolves around
>csh, but the rest of us don't. 
>
>	Seriously, whats the rationale behind this half hearted atempt at
>making /bin/sh look like ksh ?

The BSD /bin/sh is attempting to be POSIX.2-compliant.  The POSIX.2
standard specifies that the file named by $ENV is sourced when the
shell is invoked.  Look at POSIX 1003.2-1992, section 3.5.3.

Personally, I think $ENV should be processed only by interactive shells.
ksh93 and bash-2.0 (when invoked as `sh') do it that way.
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu