[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
${var-$default} vs. ${var=$default} (was: Re: [PATCHES] Bootstrap: Allow
From: |
Stefano Lattarini |
Subject: |
${var-$default} vs. ${var=$default} (was: Re: [PATCHES] Bootstrap: Allow user overriding of $AUTOCONF and $PERL.) |
Date: |
Wed, 28 Jul 2010 00:21:35 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
[Removing automake-patches from CC]
At Tuesday 27 July 2010, Eric Blake wrote:
> On 07/27/2010 03:37 PM, Stefano Lattarini wrote:
> >>> I'm used to this variant, with less typing:
> >>> : ${AUTOCONF=autoconf}
> >>>
> >>> But your way works, too.
> >
> > Can you confirm it's as portable as the ways suggested in the
> > autoconf manual? If yes, do you think it could be an useful
> > addition to that manual?
>
> The autoconf manual already states that ${var:=value} doesn't work,
> and that if value occupies more than one word, then you need to
> use quotes or an intermediate shell variable. Then there is the
> Ultrix bug, where you need var=${var="$val"} to avoid 8-bit
> cleanliness issues, and the Solaris bug where $val containing }
> causes parse problems, leading to this recommended construct when
> you are defaulting to an unknown intermediate value:
>
> test "${var+set}" = set || var={value}
>
> But by itself, ${var=value} is portable, where value is not a shell
> substitution.
But I was using ${var-value}, and I didn't find much about it in
the autoconf manual... What I'd like to know is if `${var-$default}'
shares the same problems of `${var=$default}'.
P.S. It seems that at least the "foo=${foo='}'}" bug of Solaris
/bin/sh is also shared by "foo=${foo-'}'}... I have no access to
Ultrix, QNX or Digital Unix to test the other mentioned bugs.
Regards,
Stefano