From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29975 invoked from network); 11 Feb 2021 17:19:44 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 Feb 2021 17:19:44 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1613063984; b=f8y5PhEDapBwVRsdVa9ixZC23IfHziJ0EpxRI+fS6bleRzpKwDZZrBIEmT/V2dpPlnrI2iastp gbxGuf9rPNZGKh1cFSs4TdMTflu4DSsANsxAtHHnbVWLiMnTxsi5JFenmWH1xi0PEic9yFGauG YJ9dqaGh49SyKmbBf3JbZqN33xSLufWwowQMlmpK2kc5/4eCMebWrIfnbcnDg0+BwBFtc7zPPn lbu1UHwsq6YicMHngOT5o7vlyvOLW21hhE0CmEEEKVZxJEH0Tb8vyfklQi8CJbSc9FR4GeFWLW DExGTVPPoLs47Uq7448+D/sm8tA/4B1cfoie1cPfae3yfw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; dkim=pass header.d=larryv.me header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=pass header.from=larryv.me; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1613063984; bh=QNVRut9/OhZ/Id43W2XzPrp2agidIl1ClDCatLqfFJE=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:To:References:Message-ID:Content-Transfer-Encoding:Cc:Date: In-Reply-To:From:Subject:MIME-Version:Content-Type:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=DkS+TG8hXZ/4iQlhwxcXtWHkPz/zVLC0OdGAWDReLsQJBhI2K4gXmVSHd6vhHksGB8FQexZJdq 1eI0qOfnI6a4xZAdVsSQIeDsNwUiUVSQx7tL8OB5Bmuj3R47f/xSYW2bCpE6H8dfXLw6YQbRDS Nk61H7qDRBGDCz8TpTL7om7P1UIBsRlZJ1fD7PlfxsfwAICOLRkGgaH2jMgyRNHQR76D4wvYKh sYTdC7EGSoBcMvZgyTzlfdqTMvfiAHbUpWZ/qx9c6/FDZ0jmBV8LpqkHmOdMNNrfSycPg73SpB Tk939ezjoQ4t8lT2OTQzRsVFc1YVusgGhZkpQf3SQScYDw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:To:References:Message-Id: Content-Transfer-Encoding:Cc:Date:In-Reply-To:From:Subject:Mime-Version: Content-Type:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=sLfQezA7t7d2x/hcjsYs+8KHVmA1Bi1Vf/YL2VG27Y8=; b=FNG657d/f4AxGYcPz9XF0t9SxA OnT12TEFFTr/PatlgbVYhCIWNLa791yKZh26ZGZIXEEypZ/+j4kXLGRmuWvlriHyRxDzCa2XdXWVb YwfJbCLQwagVw+mZHBHkoHaRc/ly4BEQX4884N+meQLGBs/qiMNeuKz+vv5TyoW/yBncPmgwgEyQC y47MDPQ7iZlHyvZPBNq39Oa73vj2o665KqO+WROVuRX213GPsfhHZTqmuBJBJ94/0gYWrfizx0u+m ZzUMyhOc2C0wqHKva8RHAm2pxcmslANKZYX5V7hqli+n7+Enb1xTE8PPg0hhjRzWHrjUIrirjdXop 57qFxPGQ==; Received: from authenticated user by zero.zsh.org with local id 1lAFcz-00076F-Km; Thu, 11 Feb 2021 17:19:41 +0000 Authentication-Results: zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; dkim=pass header.d=larryv.me header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm2 header.a=rsa-sha256; dmarc=pass header.from=larryv.me; arc=none Received: from out4-smtp.messagingengine.com ([66.111.4.28]:56163) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lAFcT-0006jJ-Nr; Thu, 11 Feb 2021 17:19:11 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 722DF5C00BE; Thu, 11 Feb 2021 12:19:08 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 11 Feb 2021 12:19:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=larryv.me; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm2; bh=s LfQezA7t7d2x/hcjsYs+8KHVmA1Bi1Vf/YL2VG27Y8=; b=XVtwS51RnZWiWtAC/ kcGDJEi/I6G1XjIM7BbqO8mBht+Aj8sVQsu/l6yAr4WNG6xUH1AtoD44hs8gosbb rxeS9iaCfHQWgKFnzr+KRkT9+0wAaGF6a+ki7qUpF2ZybTICgdwgzJyXJY73GUVp mp7jrVTl+zaDwtD29nYqg0Q3fjrk6wf4YyCOTks4p3NjkOtJF4aWX/1raQHD3//t 2iHuZYx+tDuim4UeMZIWmwY+rhKXSVwWB56DLmv5ZuPcX04lRKFKLq8IaY7I3bt7 9T7sUDd61FaogNBFadAAaXKFqWpR21USibJJvRAdMY2yFXe7QvtB28XxPbTwe+0s cVr8g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=sLfQezA7t7d2x/hcjsYs+8KHVmA1Bi1Vf/YL2VG27 Y8=; b=DrSncQ3bjOJNJc8BQIjSG85MhrRE8f/fd4ITtjstPsYsvCw6zC6/oppvS CNb62NdzA0/cUs18BC68NcDiYi+IdiuPDkGiItYn0qvsd7G9g5GrlmQTG8rHcYgr trCRs/ryPorDobUde3yHysKSfA3YqJuwCEgnG3/T9kL8GZVMG8Z80gH3Tp1RN+bh o9nnTjR6hFh1/G/OZyQN24MLBcYqGbw1apdXCuC7uAIK8GcCZ8QC6VIvslehdNPm RlS/vtwKDKJNw64Oqks5pw4ohwdBKFjWQA05nMPaZ7pEYv7v0bpHVpjCf25JjifP 4r+HiZn5MIrx10ixI4BOj/3Q8KyBg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrheelgdeljecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtddvnecuhfhrohhmpefnrgifrhgv nhgtvggpgggvlhojiihquhgviicuoehvqheslhgrrhhrhihvrdhmvgeqnecuggftrfgrth htvghrnhepgeetheejueekgeffhefhjeevjeeiheegvdeugeektdegffejhfehgeetgfej ledvnecukfhppedutddtrdduvddrjeegrdeftdenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehvqheslhgrrhhrhihvrdhmvg X-ME-Proxy: Received: from [192.168.1.15] (pool-100-12-74-30.nycmny.fios.verizon.net [100.12.74.30]) by mail.messagingengine.com (Postfix) with ESMTPA id B94C7240066; Thu, 11 Feb 2021 12:19:07 -0500 (EST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: protect spaces and/or globs From: =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= In-Reply-To: <8a718224-f0e4-d960-1d65-f600ec818415@eastlink.ca> Date: Thu, 11 Feb 2021 12:19:06 -0500 Cc: zsh-users@zsh.org Content-Transfer-Encoding: quoted-printable Message-Id: <544A50D4-7F71-4763-8DEC-D5D99E4AE7CC@larryv.me> References: <52D5DA56-397F-40BB-BBA7-CE3BF7256581@larryv.me> <29a203d5-bf53-9cb7-7a49-2705c3b1d8f2@eastlink.ca> <87a6sc3d0c.fsf@lwm.klanderman.net> <752329601.3729797.1612972051119@mail2.virginmedia.com> <379883051.3731455.1612974540761@mail2.virginmedia.com> <8a718224-f0e4-d960-1d65-f600ec818415@eastlink.ca> To: Ray Andrews X-Mailer: Apple Mail (2.3445.104.17) X-Seq: 26507 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: > On Feb 11, 2021, at 11:31 AM, Ray Andrews = wrote: >=20 > while [[ $# -gt 0 ]] ; do > arg=3D"$1" > shift > grepargs+=3D( "$arg" ) > done Why are you still accreting grepargs like this? Peter has already shown you how to do this. grepargs=3D("$@") Unless your actual code actually modifies the args before adding them to the array? > Seems cleaner, the single quotes are themselves protected or replaced = so that > it not only runs right, it looks right; on recall it is visually = exactly the same. The command saved to history is correct, but it is not always exactly what you entered. % grep_wrapper on\ the\ current i,2,light\ edit i,1,old\ stable=20= what should be going to history: grep --color=3Dalways -i -- 'on the current' 'i,2,light edit' = 'i,1,old stable' [...] % pat=3D'on the current' foo=3D'i,2,light edit' bar=3D'i,1,old = stable' % grep_wrapper $pat $foo $bar what should be going to history: grep --color=3Dalways -i -- 'on the current' 'i,2,light edit' = 'i,1,old stable' [...] A ${(q-)foo} expansion basically re-quotes the value of foo so it works correctly with eval, in whatever way is requested. It doesn't know the value's origins. > And is it not intuitive that, since single quotes already > protect their string, if you add protection for the single > quotes themselves, you then have a perfectly protected string? That's not how quoting works. Quote levels don't nest to produce some kind of super-quoting. You're misinterpreting the results of your experimentation. % foo=3D'a b c' % print -r 'protected: $foo' protected: $foo % print -r "'not protected: $foo'" 'not protected: a b c' The double quotes do protect the single quotes from being interpreted by the shell, but they also permit expansions. vq=