Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: strictly literal command lines?
- X-seq: zsh-users 14527
 
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
 
- To: Eric De Mund <ead@xxxxxxxxx>
 
- Subject: Re: strictly literal command lines?
 
- Date: Tue, 3 Nov 2009 22:16:15 +0100
 
- Cc: zsh-users@xxxxxxx
 
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=gamma;        h=domainkey-signature:mime-version:received:in-reply-to:references         :date:message-id:subject:from:to:cc:content-type;        bh=+v5uwaAFgkggUZ63DHbxaTJmlwjjgYL76r943dNSdzM=;        b=Vme0IT5e0MVWlQcZ82XWo18RNQahzce2WIl/+eSG0pa+0f2dvFPr/Iq8uqrCnaXVaG         wt8bHwh7ivUbfmEqgSuBmky+YhQVaDoXWXjO5CXeuknbuIFmUB4mam5Or9+7i5qkhMh2         g2/XO5revYIOffgKjudsKZeW9yt7/CUkfrCGM=
 
- Domainkey-signature: a=rsa-sha1; c=nofws;        d=gmail.com; s=gamma;        h=mime-version:in-reply-to:references:date:message-id:subject:from:to         :cc:content-type;        b=Qo+XJQWvyUIWugRSgLojAflg/GbtNaOccpTATwvFIIIRNvkY+lKP7iVq2kqnxbFA5m         WWLeTIy004ooF8DsUAoRuEzdvfbK7v0K/OIs9wAqIXfWDc+o4kZR4BVhZ4ErZm4aB/Ll         onlXAkJwxH7cugpkIS5PXK5VqoxbG2ACGPdpI=
 
- In-reply-to: <87k4y79xxp.fsf@xxxxxxxxx>
 
- List-help: <mailto:zsh-users-help@zsh.org>
 
- List-id: Zsh Users List <zsh-users.zsh.org>
 
- List-post: <mailto:zsh-users@zsh.org>
 
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
 
- References: <87k4y79xxp.fsf@xxxxxxxxx>
 
2009/11/3 Eric De Mund <ead@xxxxxxxxx>:
> Hello,
>
> I'd like to be able to issue a command without any quotation characters
> or with only one quotation character at the beginning. Is this possible
> in zsh (ignore my line breaks here, done manually for legibility)?
>
>    % wget http://www.nytimes.com/2009/11/04/world/europe/04levistrauss\
>    .html?hp=&pagewanted=print
>
> In this particular example, the "&" is the problem for me. I want it
> taken literally.
>
> I can envision two kinds of solutions right off the bat.
>
> 1.  Is there a "literal-to-end-of-line" character? If the single quote
>    (') were such a character, the command would look like this:
>
>        % wget 'http://www.nytimes.com/2009/11/04/world/europe/04levist\
>        rauss.html?hp=&pagewanted=print
>
> 2.  Or is there an option to make a command line completely literal,
>    akin to noglob but stronger, in order to handle ampersands (&)s and
>    anything and everything else, too:
>
>        % literal wget http://www.nytimes.com/2009/11/04/world/europe/0\
>        4levistrauss.html?hp=&pagewanted=print
>
> Or am I missing some way of accomplishing this that already exists in
> zsh?
The easiest way is to write a ', paste, write another ' ;). Another way is
to press ctrl-space before, paste the url, then press quote-region (alt-" by
default i think). This is more keypresses than just typing the 's though.
Another way which is more automatic:
autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic
-- 
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author