UpdateSvn()
{
MYSELF=/Users/mikel
if [ "$2" == "" ]
then
dir=svn
else
dir=$2
fi
cd ${MYSELF}/$1
pwd
svn update $dir
echo
}
UpdateSvn thing1
UpdateSvn thing2
...It would be possible, and possibly desirable, to move all the UpdateSvn commands nto a separate file, which the script would read and exec.
UpdateSvn isn't much of an DSL, but I've got other functions for different kinds of archives--UpdateFTP, UpdateWeb (using wget), UpdateDARCS, UpdateMercurial, etc. The shell programming here is REALLY trivial, but it also meets the simplest requirements for a DSL: you could give someone with no knowledge of shell programming a list of directories, and the type of archive in each directory, and he or she could write the "update" script.
It would also be possible for a masochist to do some true metaprogramming (build up functions at runtime as strings, exec them to define the functions, etc.). That's left as an exercise for the perverse. Actually, it sounds pretty cool to me, though I'm not sure why I'd do it.
BTW, this is not in the Bash Cookbook, though arguably it should be.

Help




