Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

alias hygiene




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



Messages sorted by: Reverse Date, Date, Thread, Author