[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash quoting question
- To: Linux-IL mailing list <linux-il(at-nospam)linux.org.il>
- Subject: bash quoting question
- From: Tzafrir Cohen <tzafrir(at-nospam)technion.ac.il>
- Date: Fri, 12 Oct 2001 16:25:34 +0200 (IST)
- Delivered-To: linux.org.il-linux-il@linux.org.il
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
Hi
I'm trying to write a script:
...
NAME_SERVER="192.168.1.200"
DNS_RESOLVE="/usr/bin/adnsresfilter --config 'nameserver ${NAME_SERVER}'"
...
| ${DNS_RESOLVE} \
...
That is, the command above shsould recieve a parameter that contains a
space, and thus has to be quoted. Its value needs to be expanded from
anther variable.
The result (with set -x):
...
+ NAME_SERVER=192.168.1.200
+ DNS_RESOLVE=/usr/bin/adnsresfilter --config 'nameserver 192.168.1.200'
...
+ /usr/bin/adnsresfilter --config ''\''nameserver' '192.168.1.200'\'''
adnsresfilter: bad usage: no non-option arguments are allowed
...
It appears that the shell treats the value of DNS_RESOLVE as seperate
words, and even bothers quoting the "'" marks.
Any way around this?
(Scanning the bash manual yeilds nothing)
--
Tzafrir Cohen
mailto:tzafrir@technion.ac.il
http://www.technion.ac.il/~tzafrir
=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il