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

Regexp replace on all arguments.



 Hi folks,

  I want to replace all occurrences of say '/c/' in the arguments with 'c:'. Could someone help me with completing the function below.

  winexec () {

	  // First loop through all arguments and replace

	  foreach arguments $2 to $- {
		  replace ^/c/ with c: , ^/d/ with d: etc. (The character c, d should be preserved, '^' means beginning of the word.)
	  }

	  execute $1 with the new arguments.
	  
  }

  The execution would be

  $ winexec cacls.exe /c/name-of-file

  Now the function should change it to:

  $ calcs.exe c:/name-of-file

  Thanks in advance.



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