Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: noquote for quotes as in noglob for filename generation?
- X-seq: zsh-users 14472
- From: Philippe Troin <phil@xxxxxxxx>
- To: Nazri Ramliy <ayiehere@xxxxxxxxx>
- Subject: Re: noquote for quotes as in noglob for filename generation?
- Date: 09 Oct 2009 20:30:16 -0700
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <544dda350910092001r28997c41x5ef1ffe2e6d71982@xxxxxxxxxxxxxx>
- Mail-copies-to: nobody
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <544dda350910092001r28997c41x5ef1ffe2e6d71982@xxxxxxxxxxxxxx>
- Sender: phil@xxxxxxxx
Nazri Ramliy <ayiehere@xxxxxxxxx> writes:
> What I'm trying todo:
>
> I have a shell script named 'sql':
> that does pretty much this:
>
> $ cat ~/bin/sql
> <uninteresting details omitted...>
> sql_command=`noglob echo "$@"` # Note the noglob!
> eval mysql -u $username -p$password $db "\"$sql\""
I don't see why you need eval or noglob here...
What's wrong with replacing:
sql_command=`noglob echo "$@"` # Note the noglob!
eval mysql -u $username -p$password $db "\"$sql\""
with simply:
mysql -u $username -p$password $db "$*"
?
The mechanism you want is:
${(q)variable} # Escaped
${(qq)variable} # Single quoted
${(qqq)variable} # Double quoted
(depending on which kind of quoting you want).
But again, if you remove the unnecessary intermediary variable and
eval, you shouldn't need it.
Phil.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author