From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-users-return-23689-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 3faf9521 for ; Sun, 30 Sep 2018 14:03:38 +0000 (UTC) Received: (qmail 19842 invoked by alias); 30 Sep 2018 14:03:25 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23689 Received: (qmail 9952 invoked by uid 1010); 30 Sep 2018 14:03:25 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua1-f48.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.222.48):SA:0(-1.9/5.0):. Processed in 3.781978 secs); 30 Sep 2018 14:03:25 -0000 X-Envelope-From: pierpaolog@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gCxfiz0/AtLRKt8oUfqyl61wOdmUyCPevT6kMqnH0HA=; b=aytOs7n4Fkzxyg9H46Dtc9fV9GOQfgsNowJfdPgAE+ABskAr70lJRiTv9+jOi0vQza yeSiY9zOza2f7EAlNBNqOEl0t/y43ykEdcV6aMwrG6buvhD36PhutchOVOdrHV3urScV XJVGCpYOD6TeuSYri971JaoHMUIporDlQILbr9yh06Le8K1ud9ffokyjaVkp/3YApDVT g/hcJfXpRgvNLJiNz0TDcuvTRtAX/ELzPxgaHh/chKk2Md16QWh2ulUKFWrchLOV94Te u7xKekJwHl/a9qrtjDHcKM/A1zPajVLfI63uzodMoHajl2ZhMhmqkBMVb+3gNRdmeoje HCtw== X-Gm-Message-State: ABuFfoiJTe8hMzOW2u1iEadr8X0IEVsApxxMvgs7E8IYzrWyZe8eQFuy zPk21ezhneVigP9yqxmQi8bF6xreMHzW89C+llE= X-Google-Smtp-Source: ACcGV62UwR4dL0G52y14GF0+RIDqUwO6D6sKqLrwHbTrITk3OLJwdMtQF6Yk3VDKzp0gSv7yqXHeTZeSKTquX6GTohY= X-Received: by 2002:ab0:6150:: with SMTP id w16-v6mr2979564uan.113.1538316197588; Sun, 30 Sep 2018 07:03:17 -0700 (PDT) MIME-Version: 1.0 References: <2227420.SXgfRXvH8g@march> In-Reply-To: <2227420.SXgfRXvH8g@march> From: Pier Paolo Grassi Date: Sun, 30 Sep 2018 16:02:40 +0200 Message-ID: Subject: Re: howto run curl again with quoted argument if it failed due to parsing error? To: chiasa.men@web.de Cc: Zsh-Users List Content-Type: multipart/alternative; boundary="00000000000082744905771726b1" --00000000000082744905771726b1 Content-Type: text/plain; charset="UTF-8" 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 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@gmail.com linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217 founder: https://www.meetup.com/it-IT/Machine-Learning-TO --00000000000082744905771726b1--