can someone enlighten me??

Richard W.M. Jones rjones at redhat.com
Wed Nov 19 13:33:54 UTC 2008


On Wed, Nov 19, 2008 at 02:23:18PM +0100, Farkas Levente wrote:
> the compile, install etc and:
> VAR="`rpm --eval %{_mingw32_cflags}`";set|grep VAR
> then the outputs:
> ---------------------------------------
> VAR=$'-O2 \\\n                            -g '
> VAR='-O2 -g'
> ---------------------------------------
>    ^^^
> you see if there is a line break then there is an extra "$" at the
> beginning!

Take it one step at a time:

$ rpm --eval %{_mingw32_cflags}
-O2 -g -pipe -Wall \
                          -Wp,-D_FORTIFY_SOURCE=2 \
                          -fexceptions \
                          --param=ssp-buffer-size=4

$ var='a \
> b'

$ echo $var
a \ b

$ set | grep var
var=$'a \\\nb'

If you read the manual page to bash you'll see that $'string' is a
special form of quoting which allows certain backslash-escaped
characters to be used, eg. \n for newline.

So the literal value of $var is:

  a <space> <backslash> <newline> b

Anyway, what are you actually trying to achieve?  I'm assuming this is
part of your plan to combine /etc/rpm/macros.mingw32 and
/usr/bin/mingw32-configure into a single script.  This is an admirable
goal because it reduces duplication, but if it means using some
massively complex shell hackery instead, then the cure might be worse
than the disease.

I'd prefer to see a patch which keeps the duplication, if that's going
to be quicker.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top



More information about the mingw mailing list