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

histsubstpattern in zmv



The csh-style ${var:s/foo/bar} is often more legible and easy
to cumulate than the Korn-style equivalent ${var/foo/bar}

Compare:

${${(L)var//[[:blank:]]/_}//\/foo[^/]#}

with:

${var:l:gs/[[:blank:]]/_:gs|/foo[^/]#|}

The csh-style also has :& to repeat.

But that needs set -o histsubstpattern and in zmv, emulate -LR
zsh resets options.

Would it be possibe to enable it in zmv along with extendedglob
which is already enabled there, or if not allow the user to enable it,
or maybe even better introduced some :+s/pattern/repl/
:-s/string/repl/ or :S/pattern/replacement/ so we can use both
at the same time, like ${f:gs/***/3-stars/:gS/???/any-3-chars} ?

Thanks,
Stephane




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