Date: Fri, 11 Jul 2008 01:33:45 +0930 From: Malcolm Kay <malcolm.kay@internode.on.net> To: freebsd-questions@freebsd.org Subject: Re: snippet of configure script - explain please Message-ID: <200807110133.45331.malcolm.kay@internode.on.net> In-Reply-To: <200807101704.40038.fbsd.questions@rachie.is-a-geek.net> References: <20080709172513.GA51206@mech-cluster238.men.bris.ac.uk> <200807110018.43081.malcolm.kay@internode.on.net> <200807101704.40038.fbsd.questions@rachie.is-a-geek.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 11 Jul 2008 12:34 am, Mel wrote: > On Thursday 10 July 2008 16:48:42 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=$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, > > Hmm, I'm not sure if the colon syntax came first. Looks like your supposition is correct. I dug out an old DEC Ultrix manual which ducuments an 'sh' shell and a 'sh5' shell the 'sh' being the "normal" bsd version of the Bourne shell and 'sh5' being a compatibility version for system V scripts. The former (bsd version) does not use the ':' in parameter substitutions. But the system V version does. > Autotools claims to create > portable shell code, though they > also claim to make software developer's > lives easier. Malcolm
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807110133.45331.malcolm.kay>