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

Re: Regexp replace on all arguments.



On Sat, Feb 11, 2006 at 05:38:19PM +0000, Stephane Chazelas wrote:
> winexec() {
>   local cmd=$1
>   shift || return
>   argv=("${@//#\/(#b)([a-zA-Z])\//$match:}")
>   "$cmd" "$@"
> }
> 

 I couldn't get it to work. There is no substitution happening at all. I am getting the same arguments.

 winexec cacl.exe /c/name-fo-file

 gives: cacls.exec /c/name-of-file.

 I am sure the code is the right direction, and but there is some silly bug which makes it fail. I am actually used to vim/emacs syntax for string substitution, but I found the zsh syntax to be a bit exotic. Especially since zsh has SO many special cases. So if you could explain the above, I would be able to correct it myself.

  argv=("${@//#\/(#b)([a-zA-Z])\//$match:}")

  I take it that the first '@' stands for all arguments.

  What's the /#?
  what's (#b)?
 ([a-zA-Z]) stands for 1 character, enclosed in a paranthesis for its use in the replace regexp.

 Thanks.




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