Skip to content

Instantly share code, notes, and snippets.

@joshtronic
Created January 29, 2012 22:28
Show Gist options
  • Save joshtronic/1701049 to your computer and use it in GitHub Desktop.
Save joshtronic/1701049 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Assists in adding files currently not in a Subversion repository by
# automatically prompting you as to whether or not you want to add each
# file not currently in the repository
#
# @author Josh Sherman
# @link http://joshtronic.com
if [ -z "$1" ]; then
echo "Usage: svn-add.sh /path/to/svn/repository"
exit
else
svn_status=`svn status $1`
fi
add_file=false
for i in $svn_status; do
if [ $add_file == true ]; then
echo -n "Add $i? [Y/n]: "
read confirm
if [ -z $confirm ] || [ $confirm == "Y" ] || [ $confirm == "y" ]; then
svn add $i &> /dev/null
echo "Added $i"
fi
fi
if [ $i == "?" ]; then
add_file=true
else
add_file=false
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment