On 1/9/06, Bruce Dubbs <[EMAIL PROTECTED]> wrote:
> SFLAGS="${CFLAGS:--O3} -fPIC"
>
> Note the colon and missing internal double quotes.

The colon is a bashism.  On /bin/sh, the colon doesn't work.  Wait, I
thought the colon was a bashism, but on the RHEL3 system at work, it
works with ash, zsh and ksh.  They essentially do the same thing, but
:- checks for unset or null, and - just checks for unset.  From man
bash,

       In each of the cases below, word is subject to tilde expansion, parame-
       ter expansion, command substitution, and  arithmetic  expansion.   When
       not  performing substring expansion, bash tests for a parameter that is
       unset or null; omitting the colon results in a test only for a  parame-
       ter that is unset.

So, I guess you could put the colon in.  It should work the same
except in the situation where CFLAGS is null:

$ export CFLAGS=""
$ echo ${CFLAGS:--O3}
-O3
$ echo ${CFLAGS--O3}

What do you think is more proper?

--
Dan
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to