Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: quoting arguments in a script
- X-seq: zsh-users 13330
- From: denis <mu_kuh@xxxxxxxx>
- To: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- Subject: Re: quoting arguments in a script
- Date: Wed, 15 Oct 2008 19:58:04 +0200
- Cc: "zsh-users@xxxxxxxxxx" <zsh-users@xxxxxxxxxx>
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.de; h=Received:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References:X-Mailer:Mime-Version:Content-Type:Content-Transfer-Encoding; b=nB2AQ6dE8pWnhEoYR++7FfvuoiFQpfUL75u8mkSjjH+PTBHGxfsJswEjIfO4y5SWysxv2Buu2vIVMnepIWcfCLITomfZoKcKC88ode9pRI96Svd3YPBtMuvoMNXg3HrLInHlS0KwuFgP3AxBbRO8/8c4OUVpEent2LV0ASUxsNk= ;
- In-reply-to: <20081015001843.GA87142@xxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20081014212839.bb5ecbad.mu_kuh@xxxxxxxx> <20081015001843.GA87142@xxxxxxxxxxxxxxxxxxxx>
Phil Pennock wrote:
> On 2008-10-14 at 21:28 +0200, denis wrote:
> > I'm looking for a way to quote strings in a zsh script.
>
> you should probably be looking at something like:
>
> ${(q)^^@}
Thank you very much, that's what I was looking for.
Although it took me a while until I figured out how to accomplish
the whole task:
#!/bin/zsh
helper () {
emacsclient -e \
"(progn
(cd \"$PWD\")
(grep ${(qqq)${(q)@}}))"
}
helper grep -nH "$@"
The arguments have to be quoted twice. One level as the parameter
to emacsclient and another one for the parameters to the
grep-command.
And then I had the problem with appending the $@-arguments to
"grep -nH", why I added the helper-function.
Probably not the neatest way to do it, but it works.
Regards,
Denis
PS: If you are using emacs you should try the script. Grepping is
more fun if you can click the results :-)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author