zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: protect spaces and/or globs
Date: Wed, 10 Feb 2021 12:53:45 -0800	[thread overview]
Message-ID: <ff295c60-0697-d47a-4391-25931400a148@eastlink.ca> (raw)
In-Reply-To: <379883051.3731455.1612974540761@mail2.virginmedia.com>

On 2021-02-10 8:29 a.m., Peter Stephenson wrote:
>
> As always, that depends what you're actually doing, which is a superset of
> what you're telling us you're doing,
It's hard to put it briefly and still accurately.  I went down a certain 
path when I first
got involved and it might not have been the right path nevertheless it 
has a certain
power.  My wrappers evolve and evolve with more and more filtering and 
coloring
and columnizing and massaging and end up with some monstrous actual command
strings to execute.  By being able to recall the actual command, I can 
edit it to find
some bug very quickly.  My function assembled: " grep-i -- arg arg " 
when what was
wanted was: " grep -i -- arg arg " . Once I know where the bug is, I can 
figure out
where it came from in my function very quickly.   So I assemble my 
string, save it
to history (optionally) and then eval it to fire it off.  Up arrow, and 
voila!  I have the
guts of what my function did, available to tweak.  So:

9 /aWorking/Zsh/Source/Wk 3 $ l ,H l,*

LISTING of "l,*": all file types, INsensitive. Sorting upside down by: 
Mod. Time:

  11434 [2021-01-07--08:49] l,6,NO H
  10516 [2021-01-07--08:49] l,4,BUG and case now insensitive
...
  15988 [2021-02-03--20:06] l,51,colorize all matches if leading wildcard
  15614 [2021-02-04--16:34] l,52,bug with totals

Items found: 52
Total bytes in this directory: 3.5M
Total including subdirs: 16M

... and how did that actually happen?  " ,H " orders a write to history 
so up arrow and:

9 /aWorking/Zsh/Source/Wk 3 $ ls -AFrGgdt --time-style='+[%F--%H:%M]' 
--group-directories-first --color=always  (#i)l,* 2> /dev/null   | sed 
-r "s|^(.{10} {1,2}[[:digit:]]{1,2} )| |"  | egrep -v '^total' | egrep 
-i --color=always "^|] l,*"                      | sed -r 
"s/\x1b\[01;31m\x1b\[K\] /\] \x1b\[01;31m\x1b\[K/g"

... that's the actual guts of the thing.  No, I'm not insane, I just 
like color, prefer to remove all the permissions stuff since it it 
irrelevant to me, etc.  But the whole show requires the whole command to 
exist as a string so it can be saved and thus it needs 'eval' to fire it 
off ... unless I'm mistaken.

If that makes any sense.  It all works quite fine but there are these 
quoting issues now and then.






  reply	other threads:[~2021-02-10 20:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 20:42 Ray Andrews
2021-02-09 21:05 ` Lawrence Velázquez
2021-02-09 21:08 ` Peter Stephenson
2021-02-09 23:45   ` Ray Andrews
2021-02-10  0:22     ` Lawrence Velázquez
2021-02-10  0:51       ` Ray Andrews
2021-02-10  1:46         ` Lawrence Velázquez
2021-02-10  2:25           ` Ray Andrews
2021-02-10  2:52             ` Lawrence Velázquez
2021-02-10  1:52         ` Greg Klanderman
2021-02-10  2:29           ` Ray Andrews
2021-02-10 15:18           ` Ray Andrews
2021-02-10 15:47             ` Peter Stephenson
2021-02-10 16:19               ` Ray Andrews
2021-02-10 16:29                 ` Peter Stephenson
2021-02-10 20:53                   ` Ray Andrews [this message]
2021-02-10 22:14                     ` Bart Schaefer
2021-02-11 16:31                       ` Ray Andrews
2021-02-11 17:19                         ` Lawrence Velázquez
2021-02-11 19:48                           ` Ray Andrews
2021-02-10 18:08                 ` Bart Schaefer
2021-02-10 20:56                   ` Ray Andrews
2021-02-10 16:28             ` Lawrence Velázquez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ff295c60-0697-d47a-4391-25931400a148@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).