From: Ray Andrews <rayandrews@eastlink.ca>
To: Zsh Users <zsh-users@zsh.org>
Subject: alias hygiene
Date: Wed, 14 Feb 2018 08:09:42 -0800 [thread overview]
Message-ID: <1679a1e0-f716-e501-c4c2-f7e485f9701f@eastlink.ca> (raw)
[ some test ] && alias _grep="egrep --color=always "$string""
|| alias _grep="egrep --color=always
"^|$1|$string""
... the alias will end up downstream from a pipe which is why there's no
filespec.
Is that sort of thing sanitary? It seems to work and it's simpler than
making a function call but it makes me feel queasy. I'd like to use one
line after cobbling together the argument string based on the test, but
"^|$1|$string" is only understandable to egrep so we can't pre-digest
it. It seems I need the two lines. I'm leery of some gotcha, but it
seems ok so far.
next reply other threads:[~2018-02-14 16:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 16:09 Ray Andrews [this message]
2018-02-17 0:30 ` Daniel Shahaf
2018-02-17 3:14 ` Ray Andrews
2018-02-17 13:54 ` Daniel Shahaf
2018-02-17 15:20 ` Ray Andrews
2018-02-17 15:30 ` Daniel Shahaf
2018-02-17 15:42 ` Ray Andrews
2018-02-17 22:04 ` Bart Schaefer
2018-02-18 0:17 ` Ray Andrews
2018-02-18 2:10 ` Bart Schaefer
2018-02-18 3:38 ` Ray Andrews
2018-02-19 6:37 ` Bart Schaefer
2018-02-27 13:48 ` Vincent Lefevre
2018-02-27 15:26 ` Ray Andrews
2018-02-17 15:36 ` Daniel Shahaf
2018-02-17 21:40 ` Bart Schaefer
2018-02-18 0:08 ` Ray Andrews
2018-02-19 6:28 ` Bart Schaefer
2018-02-19 18:14 ` 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=1679a1e0-f716-e501-c4c2-f7e485f9701f@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).