Re: error: Macro % has illegal name (%define) ?
Marius Feraru <[email protected]>
| Newsgroups | gmane.linux.redhat.rpm.general |
|---|---|
| Organization | n0i.net |
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Patrick wrote:
> If I try to run the following script [...]
>
> #!/bin/bash
> cd ~/redhat/SPECS
> BUILDOPTS_libsupertone='--define "_smp_mflags -j1"'
> rpmbuild -ba --target=i386 libsupertone.spec ${BUILDOPTS_libsupertone}
>
> I get this error:
>
> error: Macro % has illegal name (%define)
Not really a RPM issue, but a bash one (and a quite reiterated one on bash
"forums", I may say). Let's rewrite your script:
#!/bin/bash
cd ~/redhat/SPECS
# avoid word splitting on "space"
IFS=$'\n'
# skip quotes, as popt (obviously) won't "dequote" arguments
BUILDOPTS_libsupertone='--define _smp_mflags -j1'
rpmbuild -ba --target=i386 libsupertone.spec ${BUILDOPTS_libsupertone}
# EOF
In the future, when you have bash troubles, try the "easy" debug way:
add "-x" to the shellbang (i.e.: #!/bin/bash -x). It usually helps :)
Try it on your script, you'll see how bash expands your variables.
cheers
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----
iD8DBQFHIHlmtZHp/AYZiNkRAiBJAKCCclEuNTYzYYCrxtJKsIXisIAdywCgqUFQ
eQ+oPMmYphSWxY2YGYkY8Rg=
=fkjM
-----END PGP SIGNATURE-----