From owner-freebsd-questions@FreeBSD.ORG Thu Jul 10 17:09:55 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 204C91065678 for ; Thu, 10 Jul 2008 17:09:55 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id DE6488FC33 for ; Thu, 10 Jul 2008 17:09:52 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.2/8.14.2) with ESMTP id m6AH9Xw6012211; Thu, 10 Jul 2008 18:09:35 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.6.0 smtp.infracaninophile.co.uk m6AH9Xw6012211 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1215709776; bh=GY1iW2pWGquV68 VrMSDi4rXBb6gdLbIYUaq89B7ozNs=; h=Message-ID:Date:From:MIME-Version: To:CC:Subject:References:In-Reply-To:Content-Type:Cc:Content-Type: Date:From:In-Reply-To:Message-ID:Mime-Version:References:To; z=Mes sage-ID:=20<48764246.8080904@infracaninophile.co.uk>|Date:=20Thu,=2 010=20Jul=202008=2018:09:26=20+0100|From:=20Matthew=20Seaman=20|Organization:=20Infracaninophile|User -Agent:=20Thunderbird=202.0.0.14=20(X11/20080607)|MIME-Version:=201 .0|To:=20Malcolm=20Kay=20|CC:=20Mel=2 0,=20=0D=0A=20Anton=20Shterenl ikht=20,=0D=0A=20freebsd-questions@freebsd.org |Subject:=20Re:=20snippet=20of=20configure=20script=20-=20explain=2 0please|References:=20<20080709172513.GA51206@mech-cluster238.men.b ris.ac.uk>=09<200807101354.46321.malcolm.kay@internode.on.net>=09<2 00807101415.51455.fbsd.questions@rachie.is-a-geek.net>=20<200807110 018.43081.malcolm.kay@internode.on.net>|In-Reply-To:=20<20080711001 8.43081.malcolm.kay@internode.on.net>|X-Enigmail-Version:=200.95.6| Content-Type:=20multipart/signed=3B=20micalg=3Dpgp-sha256=3B=0D=0A= 20protocol=3D"application/pgp-signature"=3B=0D=0A=20boundary=3D"--- ---------enig32D090D6E4798516C5B9D567"; b=SBUql3J6wgx/8y2pLL54CP+TU kPn4fC0yPxc6Lw6J1xANIG7GmJo8SdUJoDeQoZ5gV++4mZ3zZX42jhHbn+ZuPhyCVme KYAsngWnGjyS/gBdaJQOGMYk2I+ebaj6SritLbqllI15HR/vd59/KXecbn+gkfAXFRd z0b5HoUDgFLI= Message-ID: <48764246.8080904@infracaninophile.co.uk> Date: Thu, 10 Jul 2008 18:09:26 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.14 (X11/20080607) MIME-Version: 1.0 To: Malcolm Kay 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> <200807110018.43081.malcolm.kay@internode.on.net> In-Reply-To: <200807110018.43081.malcolm.kay@internode.on.net> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig32D090D6E4798516C5B9D567" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0 (smtp.infracaninophile.co.uk [IPv6:::1]); Thu, 10 Jul 2008 18:09:36 +0100 (BST) X-Virus-Scanned: ClamAV 0.93.1/7686/Thu Jul 10 16:27:03 2008 on happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: Anton Shterenlikht , Mel , 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 17:09:55 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig32D090D6E4798516C5B9D567 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Malcolm Kay wrote: > 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=3D$as_ac_var; eval "test \"\${$as_var+set}\" =3D= 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 "", otherwis= e you=20 >> get "set": >> $ echo ${foo+set} >> >> $ echo ${HOME+set} >> set >=20 > So it appears; but is it stated anywhere that this shorthand is legitim= ate? > I find it quite frequently arising from the GNU configuring tools but > haven't found it elsewhere. >=20 > Is it a deliberate shorthand or just a consequence of the way sh and ba= sh=20 > happen to have been programmed? In other words is it a safe shorthand? >=20 > Anyway thanks for the clarification, This syntax is certainly legitimate, and it is covered in the sh(1) man page. However, the relevant section talks mostly about the related form: ${parameter:+word} which means 'evaluate to null unless ${parameter} is unset or null, other= wise evaluate to "word"'. Then there's a very small and easily missed note to the effect: "In the parameter expansions shown previously, use of the colon in the format results in a test for a parameter that is unset or null; omissi= on of the colon results in a test for a parameter that is only unset." So ${parameter+word} means 'evaluate to null unless ${parameter} is unset= , otherwise evaluate to "word"' Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW --------------enig32D090D6E4798516C5B9D567 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEAREIAAYFAkh2Qk0ACgkQ8Mjk52CukIzkXQCeICcDCLBguFpLuxNPjmImHaye peMAnjXnh+/CB1Mxln4KfpYJ+Rk2bG5Y =PyDi -----END PGP SIGNATURE----- --------------enig32D090D6E4798516C5B9D567--