From owner-freebsd-bugs Fri Jun 14 1:40:46 2002 Delivered-To: freebsd-bugs@freebsd.org Received: from goose.mail.pas.earthlink.net (goose.mail.pas.earthlink.net [207.217.120.18]) by hub.freebsd.org (Postfix) with ESMTP id 0DA1237B40E for ; Fri, 14 Jun 2002 01:40:41 -0700 (PDT) Received: from sdn-ar-003dcwashp207.dialsprint.net ([206.133.21.119] helo=moo.holy.cow) by goose.mail.pas.earthlink.net with esmtp (Exim 3.33 #2) id 17Imd4-0006CF-00; Fri, 14 Jun 2002 01:40:23 -0700 Received: by moo.holy.cow (Postfix, from userid 1001) id 5BC5851458; Fri, 14 Jun 2002 04:42:27 -0400 (EDT) Date: Fri, 14 Jun 2002 04:42:27 -0400 From: parv To: Peter Pentchev Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin/39198: sh aborts on variables with periods Message-ID: <20020614084226.GA62568@moo.holy.cow> References: <200206140750.g5E7o3A03840@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200206140750.g5E7o3A03840@freefall.freebsd.org> Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org in message <200206140750.g5E7o3A03840@freefall.freebsd.org>, wrote Peter Pentchev thusly... > > if [ "$SHELL" = "/bin/ksh" ]; then > ksh-specific code > else > plain ol' Bourne shell > fi > > ..or maybe even.. > > if expr "$SHELL" : '.*ksh$'; then > ksh-specific code > else > plain ol' Bourne shell > fi > > ..which would match 'ksh', '-ksh', '/bin/ksh', '/usr/local/bin/ksh', > and other variations. one problem w/ using $SHELL is when a second shell is executed as a subprocess. for example, say i am in bash (login shell) & type "ksh93" on the prompt, $SHELL will still be set to bash. so far my solution is (for either login shell or plain old execution on prompt) to check $0 ... case $0 in ksh* | -ksh* ) ksh specific things but still can't use ${.sh.version} if expecting (freebsd) bourne shell not to carp ;; bash* | -bash* ) $BASH_VERSION should do just fine (at least in v 2.0[45]) ;; * | sh | -sh) default/most conservative settings perhaps ;; esac ...below is my ~/.profile (basically for ksh93; sh & bash thrown in just for fun)... http://www103.pair.com/parv/comp/unix/cf/sh/profile - parv -- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message