Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: howto run curl again with quoted argument if it failed due to parsing error?
- X-seq: zsh-users 23689
- From: Pier Paolo Grassi <pierpaolog@xxxxxxxxx>
- To: chiasa.men@xxxxxx
- Subject: Re: howto run curl again with quoted argument if it failed due to parsing error?
- Date: Sun, 30 Sep 2018 16:02:40 +0200
- Cc: Zsh-Users List <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gCxfiz0/AtLRKt8oUfqyl61wOdmUyCPevT6kMqnH0HA=; b=qE70y5wKcLoenx/ItjgUsH7HWGUqVQ0gg4zTgoDHJKJVPbGGtgQy2IubOiJYvckUTL YWkRriMaHif8frlYWjiMw+Wk8fmOWSojKMj0oOMoNFLqXAFiijm58KiRv1D7CM9vzbMS I3mEXLKJusAAA6GnGm5Cr3giW/ojpiDRQzeTZ7PazRE1Ic2X/57/i3ZLe0TQG65gDGTW KOIzy1YHl43YHqfDwpolGOviTDTv0qrkMtfYB1ie7EYQJOjM4xcJBK3JtquOHO6mAbwg RQKb+1cxiCvofLdFOqGtRk6/WnTrXripHgPPbhJbYip3MmkDiLiH1X+lVGQNE/xU+RGB vf8Q==
- In-reply-to: <2227420.SXgfRXvH8g@march>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <2227420.SXgfRXvH8g@march>
hello, you should quote the "offending" argument, since it contains shell
metacharacters
curl
https://www.google.com/search?q=test&ie=utf-8&oe=utf-8&client=firefox-b-ab
should become
curl "
https://www.google.com/search?q=test&ie=utf-8&oe=utf-8&client=firefox-b-ab"
you can use single or double quotes, or you can escape (prefixing with a
blackslash) only the & and the ? character, since they both are shell
metacharacters, like this:
curl
https://www.google.com/search\?q=test\&ie=utf-8\&oe=utf-8\&client=firefox-b-ab
you can read more about shell metacharacters here:
http://faculty.salina.k-state.edu/tim/unix_sg/shell/metachar.html
I hope to have been helpful, best regards
Il giorno dom 30 set 2018 alle ore 15:55 chiasa.men <chiasa.men@xxxxxx> ha
scritto:
> if you call e.g. curl with a link that contains an & zsh says:
> zsh: parse error near `&'.
>
> Is there an zsh idiom to fix that?
> I came up with
> curl ^@|ctrl+shift+v|esc'.
>
> I also tried sth like
> !!:*:q
> but that doesnt return the whole link (only a part of it)
> curl
> https://www.google.com/search?q=test&ie=utf-8&oe=utf-8&client=firefox-b-ab
> zsh: parse error near `&'
> echo !!:*:q
> echo 'https://www.google.com/search?q=test&ie=utf-8&'
> https://www.google.com/search?q=test&ie=utf-8&
>
> Is that related to my zshrc entry:
> WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
> or intended behavior? It breaks at a 'o' it seems..
>
>
> Strangely :0-$ gets the whole link:
> echo !!:0-$:q
> echo 'curl' 'https://www.google.com/search?
> q=test&ie=utf-8&oe=utf-8&client=firefox-b-ab'
> curl
> https://www.google.com/search?q=test&ie=utf-8&oe=utf-8&client=firefox-b-ab
>
> Why is that?
>
>
>
--
Pier Paolo Grassi
email: pierpaolog@xxxxxxxxx
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO
Messages sorted by:
Reverse Date,
Date,
Thread,
Author