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

Re: Recursive globbing shorthand (a la **.c)



On Wed, Oct 28, 2015 at 02:27:38PM +0100, Mikael Magnusson wrote:
> If this is something you do often, you can do
> alias -g '**.c=**/*.c'

It *is* something I do a lot, but with varying patterns.  A kind
of "regexp" alias woud allow that:

  alias -R REGEXP=REPLACEMENT   # usual regexp syntax plus back references
  alias -g -R [.][.][.]='../..'
  alias -g -R [*][*]\([^*/]\)='**/*\1'

(or give up the pretense that "search and replace" can be
expressed as "x=y" patterns:

  alias -g -R 's:[.][.][.]:../..:g'       # replace all (g flag)
  alias -g -R 's:[*][*]([^*/]):**/*\1:'   # replace one (no flags)
)

I frequently miss such a feature that allows some user defined
preprocessing of command lines.

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany



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