From owner-freebsd-bugs Wed Jun 12 13:10:13 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D6A2937B40C for ; Wed, 12 Jun 2002 13:10:03 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5CKA3L09165; Wed, 12 Jun 2002 13:10:03 -0700 (PDT) (envelope-from gnats) Date: Wed, 12 Jun 2002 13:10:03 -0700 (PDT) Message-Id: <200206122010.g5CKA3L09165@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Joe Kelsey Subject: Re: bin/39198: sh aborts on variables with periods Reply-To: Joe Kelsey 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 The following reply was made to PR bin/39198; it has been noted by GNATS. From: Joe Kelsey To: Matthias Buelow Cc: Joe Kelsey , FreeBSD-gnats-submit@FreeBSD.org Subject: Re: bin/39198: sh aborts on variables with periods Date: Wed, 12 Jun 2002 13:05:24 -0700 Matthias Buelow wrote: > Joe Kelsey wrote: > >> /bin/sh does not gracefully accept variables with periods. > > > Neither does ksh88, the direct predecessor to ksh93, which is used > as "sh" and "ksh" on most Unix systems, so you have to modify your > startup script in any case. It answers with almost exactly the > same message as fbsd /bin/sh. > >> Either /bin/sh has to allow parameters to contain periods or it >> has to provide a reliable method of detecting /bin/sh versus >> ksh. > > > Try to check for RANDOM, which does not exist on sh. It probably > exists on bash (haven't checked) but you can check that through > the existance of BASH_VERSION. Similarly probably for zsh. > Then try to check for KSH_VERSION to draw the line between ksh and > pdksh. Then you might do a strings ${0##-}|grep "@(#)Version" > (or use what(1)) and check for "M 1993" which is a bit wasteful but > if you really want to know then that'll work. Then you probably want > to differentiate further since some earlier version of the '93 edition > did not support everything that is described in the Kornshell book > (if you're really pedantic.) > Thanks for the suggestions. So far I am not concerned about bash or zsh, but I will keep it in mind. I just want to separate generic ksh from /bin/sh, and RANDOM should do that. The check for KSH_VERSION fails in ksh93 since they went to the .sh.version parameter and dropped KSH_VERSION completely, a real killer. /Joe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message