On Thu, 19 Oct 2006 20:43:28 +0000 (UTC) "Duncan" <1i5t5.duncan@cox.net> wrote: > Simon Stelling posted 45379CDC.1010504@gentoo.org, > excerpted below, on Thu, 19 Oct 2006 17:42:20 +0200: > > > If you want to add instead of replace, CFLAGS="${CFLAGS} -fadded" > > will do the job. Removing is done with CFLAGS=" ${CFLAGS}" ; > > CFLAGS=${CFLAGS//-fremoved} FWIW I think Simon meant: CFLAGS=" ${CFLAGS}" ; CFLAGS=${CFLAGS// -fremoved} assuming that adding the space was done to catch flags that match part of longer flags. > > So you can do effectively anything, given you know the bash > > tricks ;) > > Hey, thanks! The add was a no-brainer here, but I hadn't thought > about the remove trick yet. Very nice! =8^) Watch also for flags that start with the same string; for example: CFLAGS=${CFLAGS// -finline-functions} would end up with "-called-once" in CFLAGS, if "-finline-functions-called-once" was set. Another easy one is doing: CFLAGS=${CFLAGS// -g} when CFLAGS has "-ggdb2" or similar set... -- Kevin F. Quinn