zsh-users
 help / color / mirror / code / Atom feed
* alias hygiene
@ 2018-02-14 16:09 Ray Andrews
  2018-02-17  0:30 ` Daniel Shahaf
  0 siblings, 1 reply; 19+ messages in thread
From: Ray Andrews @ 2018-02-14 16:09 UTC (permalink / raw)
  To: Zsh Users


     [ 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.


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2018-02-27 15:26 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 16:09 alias hygiene Ray Andrews
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

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).