ZSH arguments-fu

18-03-2010
Tagged development, subversion, zsh

When using Subversion from the command-line I commonly do:

svn copy ^/myproject/branches/FB-branch1 \
         ^/myproject/branches/FB-branch2
svn switch ^/myproject/branches/FB-branch2

This is a lot of typing. One way of working around this a wrapper around svn to automate these patterns, but another is using shell power. I use zsh, but bash and others can do the same with slightly different syntax:

svn copy ^/myproject/branches/FB-branch1 \
         ^/myproject/branches/FB-branch2
svn switch !!:3

Here !!:3 is the third argument of the last command. Neat!