Date: Fri, 14 Jun 2002 04:42:27 -0400 From: parv <parv@pair.com> To: Peter Pentchev <roam@ringlet.net> Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin/39198: sh aborts on variables with periods Message-ID: <20020614084226.GA62568@moo.holy.cow> In-Reply-To: <200206140750.g5E7o3A03840@freefall.freebsd.org> References: <200206140750.g5E7o3A03840@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020614084226.GA62568>