Arjan van der Gaag .nl

I’m Arjan van der Gaag and this is my website about me, code, food, photography and more. If you like, we can get in touch.


ZSH arguments-fu

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!