General TC > Programming & Scripting - Unofficial

What's wrong with my script?

(1/1)

PingPing:

--- Code: ---THAT="INSTALL_NO_USR FALSE"
for THIS in $THAT; do
    sed -i 's/# CONFIG_$THIS is not set/CONFIG_$THIS=y/' .config-test
done
--- End code ---
It doesn't work, yet I can do:

sed -i 's/# CONFIG_INSTALL_NO_USR is not set/CONFIG_INSTALL_NO_USR=y/' .config-test
sed -i 's/# CONFIG_FALSE is not set/CONFIG_FALSE=y/' .config-test

which both work.

 ???

curaga:
Different shell levels of escaping; single quote prevents any and all shell interpretation. Use double quotes to get variables expanded.

PingPing:
Thx Curaga.  I'm using ash (busybox's default).  Replacing the 's with "s fixed it.

Navigation

[0] Message Index

Go to full version