From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: unmatched '
Date: Fri, 9 Mar 2018 19:51:44 -0800 [thread overview]
Message-ID: <dc5c8ba7-290f-dee4-2d7c-7dcf09059005@eastlink.ca> (raw)
In-Reply-To: <20180310032041.GF16478@pug.qqx.org>
On 09/03/18 07:20 PM, Aaron Schrab wrote:
>
> No, that file is not included in any Debian package:
So I've since discovered. God knows where it came from, it's nothing of
mine, that's for sure. Apologies to Debian for the suggestion. I've
since killed it.
>
>
>
> Perhaps something like the following? This doesn't include the doing
> the find(1), instead it's designed to get the text to search on
> STDIN. It also doesn't use the $wwild or $ccase variables, which I
> didn't see defined anywhere. But that would be easy to add.
>
> No use of eval here. Besides being safer, that also tends to be more
> readable; although the use of recursion here cuts down on that
> improvement.
>
> Despite having zsh on the #! line, this would work with bash as well.
>
> #!/bin/zsh -u
> # Multi-color grep
>
> __mcgrep() {
> local color=$1; shift
> local pattern="$1"; shift
>
> if [[ $# = 0 ]]; then
> # No more patterns, just pass through the input
> cat
> else
> __mcgrep $((color + 1)) "$@"
> fi |
> GREP_COLOR="01;$color" grep --color=always "$pattern"
> }
>
> # Start with yellow, then blue, magenta, cyan.
> __mcgrep 33 "$@"
>
Thanks, that's interesting, I'll experiment with it tomorrow.
next prev parent reply other threads:[~2018-03-10 3:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 17:50 Ray Andrews
2018-03-09 20:23 ` Bart Schaefer
2018-03-09 22:45 ` Ray Andrews
2018-03-09 23:12 ` Ray Andrews
2018-03-10 3:20 ` Aaron Schrab
2018-03-10 3:51 ` Ray Andrews [this message]
2018-03-10 17:40 ` Ray Andrews
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=dc5c8ba7-290f-dee4-2d7c-7dcf09059005@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).