WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: What's wrong with my script?  (Read 1984 times)

Offline PingPing

  • Jr. Member
  • **
  • Posts: 97
What's wrong with my script?
« on: June 28, 2009, 05:25:06 AM »
Code: [Select]
THAT="INSTALL_NO_USR FALSE"
for THIS in $THAT; do
    sed -i 's/# CONFIG_$THIS is not set/CONFIG_$THIS=y/' .config-test
done
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.

 ???

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 9849
Re: What's wrong with my script?
« Reply #1 on: June 28, 2009, 06:11:56 AM »
Different shell levels of escaping; single quote prevents any and all shell interpretation. Use double quotes to get variables expanded.
The only barriers that can stop you are the ones you create yourself.

Offline PingPing

  • Jr. Member
  • **
  • Posts: 97
Re: What's wrong with my script?
« Reply #2 on: June 28, 2009, 06:24:07 AM »
Thx Curaga.  I'm using ash (busybox's default).  Replacing the 's with "s fixed it.