[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bash quoting question
- To: "Nadav Har'El" <nyh(at-nospam)math.technion.ac.il>
- Subject: Re: bash quoting question
- From: Tzafrir Cohen <tzafrir(at-nospam)technion.ac.il>
- Date: Fri, 12 Oct 2001 17:12:17 +0200 (IST)
- Cc: Linux-IL mailing list <linux-il(at-nospam)linux.org.il>
- Delivered-To: linux.org.il-linux-il@linux.org.il
- In-Reply-To: <20011012164707.C4441@leeor.math.technion.ac.il>
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
On Fri, 12 Oct 2001, Nadav Har'El wrote:
> On Fri, Oct 12, 2001, Tzafrir Cohen wrote about "bash quoting question":
> > It appears that the shell treats the value of DNS_RESOLVE as seperate
> > words, and even bothers quoting the "'" marks.
> >
> > Any way around this?
>
> In bash, the only solution I can think of now is using eval, like
> A="ls 'a b'"
> echo | eval $A
Thanks. It worked
> In Zsh, the way to do this is the following:
> A=(ls 'a b')
> echo | $A
>
> (Note using an array instead of string. Zsh had a major overhaul of the
> "traditional" handling of whitespace by other bourne-like shells).
Bash (bash2, actually) has arrays as well. The syntax is not as simple as
zsh (csh, right?), but it also works:
declare -a COMMAND
COMMAND=(program "parameters with ${SPACES}")
"${COMMAND[@]}"
--
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