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=-5.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 15232 invoked from network); 28 Sep 2022 14:33:36 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 28 Sep 2022 14:33:36 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1664375616; b=b2RcnnY5C/sv5eubuaYRSXm9+eDl5gs2rs26zYPlekDo0rYt+WY7qoiLNNn4FKf8lehpI0+2Pc pqxxtYxQDFP0JFscV+6cD7UH6dnSWIKaofrJpLezegc1J/i7JMJ/tjM5vLnsYM1s8SA1Ermnh8 g0AiQB3Z05i2I+4RzCL7mDxwbRrlaSbyqIhjC6zzwwcce4+IwPJ2l84WQOTr4Ufkhcyk+osA4Z x5/imc5CDMWJhuSlzkMHnKAF/O0rZjfsztElARG0/dBq+zEZS2vFbb+VmZ3lbH0vG6zAmxNrVZ 2+AVlnxCBaWTJ+J87j+llLAc3NFPN16ypMYLPa0AfohoPw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1664375616; bh=2H6qIWb1MkT5LYfdU7sMu6OCZ/yx/ZJeZaWq9woMhVU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:DKIM-Signature; b=sAZt9s0QC1U9pvX0F7Lp4duuGhanlQr3vs/RS+tVleEOb6z8xbei2Wu7BYKjQo9CDoQJK5Zoc7 6HiXYJOXShyotrMhxj1+fkUk4bLa4T6C3uOyy+bUOldR1poKjgJVHnD/fMJAXhcLUUxmWxENGC B3NvDErO+Q2qPWsdX8IgTBA1WfbnrYAUCS33COpRe4OxMujPlVd8Zj4lfF/KRJ9lH51wgjgCeG YZRshRGB8XiU7Cax0/QllR/n5N0mpyZW0wga3WyUpnPeNNtNVatRhlG4BozKEFhWDZ7C6g4VJq ZTzXT9plyzx7DgzoObdRZRp9mAefdcsQ1E/RZ2NI1OPfqA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-transfer-encoding: Content-type:In-reply-to:From:References:To:Subject:MIME-version:Date: Message-id:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=pgU1I0d2o/7Iufa2McrhQUJwOZ0e2w1cdEyR4SKGlpU=; b=eS6CBOuSWOdSxLF3yeLy4XgDZ8 SDOx5XPZrCaREuQ+UJgjjceUm6yonjij8c6TXp44gdG1JjLb+b5aPegGaEbShmeGsKUK1Y+lSbZpg 9jYi7ViMHDtsXmuz5cugsnyfCoOnkDriTl+lSexbRPacZlXzOmJYEF05KZxHSrTSg5HEwofNx0o/8 99hM8DtYJoeGd9n0Dm4GTNbY1B0rWPM9rAULuYg2+b3mMTYoX8WtQZn3qZjEwG43dYqYkx6PThJ40 jeAGeooUwmk6mXwctbhq732Zd9dBHkiVOeuREN5P60uv9AGoQ+UlgdDzSYc/SfYNhPESe5qNiEpg9 oKb+RYXw==; Received: from authenticated user by zero.zsh.org with local id 1odY7z-000E8K-VG; Wed, 28 Sep 2022 14:33:35 +0000 Authentication-Results: zsh.org; iprev=pass (mta03.eastlink.ca) smtp.remote-ip=24.224.136.9; dmarc=none header.from=eastlink.ca; arc=none Received: from mta03.eastlink.ca ([24.224.136.9]:47542) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1odY79-000DT7-Rn; Wed, 28 Sep 2022 14:32:44 +0000 Received: from csp02.eastlink.ca ([71.7.199.167]) by mta03.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0RIX005QE9HYCIG1@mta03.eastlink.ca> for zsh-users@zsh.org; Wed, 28 Sep 2022 11:32:42 -0300 (ADT) Received: from [192.168.0.3] ([24.207.18.108]) by Eastlink with ESMTP id dY77osASllgn7dY78opY6H; Wed, 28 Sep 2022 11:32:42 -0300 X-Authority-Analysis: v=2.4 cv=NL8QR22g c=1 sm=1 tr=0 ts=63345b0a a=xN66ZtSbq5jdJYpBp7G/jQ==:117 a=xN66ZtSbq5jdJYpBp7G/jQ==:17 a=IkcTkHD0fZMA:10 a=a_yAwmjVN5I7CgBxFD0A:9 a=QEXdDO2ut3YA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeegkedgjeelucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhepiedtjeffvefgtdehgefgteekueeggeeitedutddvvdduteetffdvveelgfeukedunecukfhppedvgedrvddtjedrudekrddutdeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrddukedruddtkedphhgvlhhopegludelvddrudeikedrtddrfegnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: 0 X-Vade-State: 0 X-EL-IP-NOAUTH: 24.207.18.108 Message-id: <0ede34f7-4684-8b48-700e-9555cccfa693@eastlink.ca> Date: Wed, 28 Sep 2022 07:32:41 -0700 MIME-version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: preserving single quotes Content-language: en-US To: zsh-users@zsh.org References: <20220928100020.tn3debb7jkytyluz@chazelas.org> From: Ray Andrews In-reply-to: <20220928100020.tn3debb7jkytyluz@chazelas.org> Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: 8bit X-Seq: 28159 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: On 2022-09-28 03:00, Stephane Chazelas wrote: > Use ${(Q)${(z)dd}} instead of $=dd. See `man zshexpn` for the meaning > of (z) and (Q). > > Roman. Didn't work. > > Use either: > > dd() aptitude search '?name(libreoffice-java-common)' > ee=$(dd) Cool.  So we can just create a little impromptu function.  Never tried that but it works.  I sorta understand that since the string isn't being handed off to something else, zsh doesn't feel the need to strip off the quotes -- the function is just as written. > > Or: > > dd="aptitude search '?name(libreoffice-java-common)'" > ee=$(eval -- $dd) My old friend eval.  But Bart advises to get away from it.  Anyway it works for now. > Or: > > dd=( aptitude search '?name(libreoffice-java-common)' ) > # or ... > ee=$( "$dd[@]" ) Works.  But that puzzles me, it seems simplest, but how is that that saving the aptitude string as an array preserves the single quotes? It seems unintuitive that the method of saving the string would make the difference. > $=dd just does $IFS-splitting. If $dd is meant to contain shell code, > you should use eval to evaluate it. But to store code, you > generally use functions not variables. The z and Q parameter > expansion flags can do the same tokenisation and quote removal > as the shell syntax parser does, but I don't think you want to > go there. I've never had anything but grief in the Q continuum.  Hard to express it, but it all seems so .... ad hoc, vague, Rube Goldberg, full of gotchas -- (qqq) doesn't work on Mondays -- impossible to remember, forced ... but your solutions above are crisp, and understandable and rememberable. Thanks gentlemen both.