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.3 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 15344 invoked from network); 2 Feb 2021 23:31:44 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 2 Feb 2021 23:31:44 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1612308704; b=bR8qDou+DAZGYTGSjy5PLwnQciAjMD9yYeg5IWohRGabU+vS+VulRkATiUbJuXRGzHD7pX5O+q 91uSc61ci5pHRgD+10Az29s8uR62V9sxbfCzjKQrk1iTe1O3j13REBHBqtcqgTZpXlTmxUHbc5 S3xBTG0QnpByfNsj2DgMETzOYzBtKuZnJUMzjjvWyFg8RIH78cVadnXYiEH1ARmdO7hHCBHNiZ 2cYGZ2ZSrR3vxINOtVxfP33uKNQ58w02qlE/a0fjTQuyaW/FZFs03J9pezKmYatm/NUfLKIP7C e5bC7YB1OxdldBMp60AxGSUmbULUgmC/mH02f9DZyOJnHw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1612308704; bh=6VyrcCC8ZixnI9ZBPIybe5+G4iTIlUm+1ZH9hgxy68g=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:To:Subject:DKIM-Signature; b=d6SEJzch9+s3ezVnqIw9GAf4iMcoNO324y/C0euO+K9U/eyIQhKk9jbWu+jSopspEpPMxRTwet KCA3BaYvIWCsZIco2oAONbDiwnazYqZaMwEJ0hQfmJfM7LYOVaB3FmjpnJx6+Xc5QeoMMubxoJ lojOhydMKYN5lJnvSjTU7/UoHot47t6TqsCrD1kwIMrLsaOT0/fbSdbh781lbZDobxUzK0R3GM 4g7PyuRt9we3Vv8E2SVqPvfijA50GjbCUYGb7XLkSk+HZZdeB9C7KS/GdLTZTbKswJW3Uor+Lo zy3YzQWkcc69StmLBeHUleGzKsY0WskXlBYHiEtBKVQRvg==; 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:Content-transfer-encoding: Content-type:In-reply-to:MIME-version:Date:Message-id:From:References:To: Subject:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=QxJqgMlR9dWoc9HWIwuHAD2tInpBLHIcH2kT2GLO6J0=; b=EQtFGlpHGbIYH8kFY09JVLCzBw kFulB2FyHCUnVf3SU3FQK38eZ9o0FQPKa4RHE9BqY6wQxHwQMC/KHl3p4P4Hi+U4x+d87l0PpP3dC AWxPev1EnXovCFwR4f/+Mn0zlN4l7axn/CP3MRoveHNpOs3OCVeyyAGePRpmO0J6U+m0lxYsL2FXT Uq/784VmiB7Gq9qqx6clbEjYZUgozCcFbMSnozirrbb2oSrNLcLZffUIXt21KNtwwE6C48hvAhnBk SsczDdesHj+OBGP+FUyvLAe55GLX+e1zJU/QKb2VQk6qUvH9wAHF4gtLxvDbRZGIaevEHUr4VDCyo Wf3LYxOw==; Received: from authenticated user by zero.zsh.org with local id 1l7594-000OYe-Qb; Tue, 02 Feb 2021 23:31:42 +0000 Authentication-Results: zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; dmarc=none header.from=eastlink.ca; arc=none Received: from mta04.eastlink.ca ([24.224.136.10]:46091) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1l758X-000OB1-52; Tue, 02 Feb 2021 23:31:09 +0000 Received: from csp02.eastlink.ca ([71.7.199.167]) by mta04.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0QNX007BPCHHY360@mta04.eastlink.ca> for zsh-users@zsh.org; Tue, 02 Feb 2021 19:31:07 -0400 (AST) Received: from [192.168.0.3] ([24.207.90.194]) by Eastlink with ESMTP id 758UlytdonkRC758VlTpJ0; Tue, 02 Feb 2021 19:31:07 -0400 X-Authority-Analysis: v=2.4 cv=B+J8bMhM c=1 sm=1 tr=0 ts=6019e0bb a=zv49KfEsxEDzuN5AGO7r0Q==:117 a=zv49KfEsxEDzuN5AGO7r0Q==:17 a=IkcTkHD0fZMA:10 a=gir0-LH0AAAA:8 a=ys_UEKoh5dpW0W6Sq8EA:9 a=QEXdDO2ut3YA:10 a=aLewGyoHDmJ4ULJHWpSz:22 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrgedugddutdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpeekvdeuuefffefhvdeuieetffdvtddvjeegueejkeeiudehieetieehgeetvdfhfeenucfkphepvdegrddvtdejrdeltddrudelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrledtrdduleegpdhhvghloheplgduledvrdduieekrddtrdefngdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: 0 X-Vade-State: 0 X-EL-IP-NOAUTH: 24.207.90.194 Subject: Re: array with newlines preserved as literal text To: zsh-users@zsh.org References: <52dba8e4-2538-7c96-ecd5-66e017ab2b8e@eastlink.ca> From: Ray Andrews Message-id: <36596ab3-14b6-da57-e40b-3e66d9ffbb5a@eastlink.ca> Date: Tue, 2 Feb 2021 15:31:06 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-version: 1.0 In-reply-to: Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 8bit Content-language: en-US X-Seq: 26452 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 2021-02-02 12:25 p.m., Bart Schaefer wrote: > On Tue, Feb 2, 2021 at 11:16 AM Ray Andrews wrote: >> >> I'm curious why you want to save this in the form of a command to be >> eval'd rather than just save the argument string? Complicated.  It goes back to my first bitch with zsh, namely not being able to capture the literal invocation of a function (along with it's tail) unexpanded, just as you'd see in history.  (History would work fine except for the fact that several commands can end up on the same line.)  Basically my wrappers do some heavy duty massaging of output and both for debugging and or for modification it's good to be able to recall the actual commands executed.  My function '_execute' does that, it calls 'eval' but does other stuff too like store to history.  Here's a sample: $  l ,Hs c,*   # 'l' wraps 'ls' and colorizes and formats the output as I like: LISTING of "c,*": all file types, INsensitive. Sorting upside down by: File Size:  10746 [2020-12-20--14:48] c,34  11168 [2020-12-27--10:39] c,35,localized help  11219 [2020-12-27--10:45] c,36  11348 [2020-12-28--13:30] c,38,delete deleted directories  11428 [2020-12-28--10:46] c,37,trivial  11665 [2020-12-28--16:17] c,39  11833 [2020-12-28--16:48] c,40,misc  13253 [2020-12-28--19:48] c,41,polishing  13376 [2020-12-28--20:09] c,42,messages improved  13383 [2020-12-29--07:02] c,43,before improved cd  14045 [2021-01-31--11:08] c,55,more one line bugs  14053 [2021-01-31--13:05] c,56,trivial edits  14156 [2021-01-30--10:48] c,54,rationalize switches  14184 [2021-01-24--20:47] c,52,interim  14186 [2021-01-29--06:17] c,53,more sky trouble. big code purge  14494 [2020-12-30--06:17] c,44,better cd to incomplete name  14925 [2020-12-30--11:55] c,47,massive edit old code purged  15493 [2020-12-30--09:41] c,45,working huge edit  15741 [2021-01-31--10:48] c,48,good old Sky above was truncated  16080 [2020-12-30--10:06] c,46,bad  16394 [2021-01-07--08:49] c,50 Items found: 1 Total bytes in this directory: 2.9M Total including subdirs: 15M ... the ',H' switch stores the actual working code to history.  Hit the up arrow and: $ ls -AFrGgdS  --time-style='+[%F--%H:%M]' --group-directories-first   --color=always  (#i)c,* 2> /dev/null   | sed -r "s|^(.{10} [[:digit:]] )| |"  | egrep -v '^total' | egrep -i --color=always "^|] c,*" | sed -r "s/\x1b\[01;31m\x1b\[K\] /\] \x1b\[01;31m\x1b\[K/g" ... hit ENTER and exactly the same output occurs.  Or modify to suit, or perhaps to chase down a bug. But it requires execution to be put off, thus the need for an eval contained within '_execute'.   Meanwhile let's see what Roman has for me.