ver.sh [download]
checks whether or not one or more directories are version controlled
checks whether or not one or more directories are version controlled
#!/bin/bash
#
# ver.sh - simple script for determining whether directories are
# version controlled
#
# TODO add support for CVS?
# scan each directory looking for a .svn or .git directory
for dir in $@; do
if [ -d $dir ] ; then
if [ -d $dir/.svn ] ; then
url=`svn info $dir | grep URL | cut -c 6-`
echo "$dir: Subversion ($url)"
elif [ -d $dir/.git ] ; then
url=`grep url $dir/.git/config | cut -c 8-`
echo "$dir: Git ($url)"
else echo "$dir: not versioned!"
fi
fi
# else: we'll silently ignore non-directories
done
Note: syntax-highlighted HTML code generated using code2html