I frequently run a simple bash command:
rpm -Uvh --define \"_transaction_color 3\" myPackage.rpm
which works properly.
But now I\'m trying to script it into a bash file, and make it more flexible:
#!/bin/bash
INSTALL_CMD=rpm
INSTALL_OPT=\"-Uvh --define \'_transaction_color 3\'\"
${INSTALL_CMD} ${INSTALL_OPT} myPackage.rpm
However, this keeps generating the error:
error: Macro % has illegal name (%define)
The error is coming from how --define
and the quoted _transaction_color
is handled.
I\'ve tried a variety of escaping, different phrasing, even making INSTALL_OPT
an array, handled with ${INSTALL_OPT[@]}
.
So far, my attempts have not worked.
Clearly, what I want is extremely simple. I\'m just not sure how to accomplish it.
How can I get bash to handle my --define
argument properly?