From owner-freebsd-questions@FreeBSD.ORG Thu Jul 10 14:48:46 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C6BF106567E for ; Thu, 10 Jul 2008 14:48:46 +0000 (UTC) (envelope-from malcolm.kay@internode.on.net) Received: from ipmail01.adl6.internode.on.net (ipmail01.adl6.internode.on.net [203.16.214.146]) by mx1.freebsd.org (Postfix) with ESMTP id AC4CD8FC1E for ; Thu, 10 Jul 2008 14:48:45 +0000 (UTC) (envelope-from malcolm.kay@internode.on.net) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhkFAHi+dUh5LQ2Y/2dsb2JhbACBWq9v X-IronPort-AV: E=Sophos;i="4.30,338,1212330600"; d="scan'208";a="146079746" Received: from ppp121-45-13-152.lns10.adl2.internode.on.net (HELO alpha.home) ([121.45.13.152]) by ipmail01.adl6.internode.on.net with ESMTP; 11 Jul 2008 00:18:44 +0930 From: Malcolm Kay Organization: at home To: Mel Date: Fri, 11 Jul 2008 00:18:42 +0930 User-Agent: KMail/1.8 References: <20080709172513.GA51206@mech-cluster238.men.bris.ac.uk> <200807101354.46321.malcolm.kay@internode.on.net> <200807101415.51455.fbsd.questions@rachie.is-a-geek.net> In-Reply-To: <200807101415.51455.fbsd.questions@rachie.is-a-geek.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807110018.43081.malcolm.kay@internode.on.net> Cc: Anton Shterenlikht , freebsd-questions@freebsd.org Subject: Re: snippet of configure script - explain please X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Jul 2008 14:48:46 -0000 On Thu, 10 Jul 2008 09:45 pm, Mel wrote: > On Thursday 10 July 2008 06:24:46 Malcolm Kay wrote: > > > > 9255 if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; > > > then > > > > I find this line somewhat strange as I've not been able > > to find documentation for the expansion of ${parameter+set} under the > > Bourne shell. (nor bash, nor ksh) > > ***************************************************** > > Presumably someone out there knows where to find it? > > ***************************************************** > > It's shorthand for ${paramter:+set}, so if unset, you get "", otherwise you > get "set": > $ echo ${foo+set} > > $ echo ${HOME+set} > set So it appears; but is it stated anywhere that this shorthand is legitimate? I find it quite frequently arising from the GNU configuring tools but haven't found it elsewhere. Is it a deliberate shorthand or just a consequence of the way sh and bash happen to have been programmed? In other words is it a safe shorthand? Anyway thanks for the clarification, Malcolm > >