svndeluser

#!/usr/local/bin/bash

if [ "$#" -lt 1 ];
then
        echo "Missing parameter.";
        echo "Usage: svndeluser.sh user1 user2 user3 ...";
        echo "";
        echo "This script creates a backup of passwd.mn and then deletes all users given as arguments from passwd.mn";

        exit;

else
        FORMATTEDDATE=$(date +"%Y-%m-%d-%H-%M-%S");
        cp -a /usr/svn/www/svn/etc/passwd.mn /usr/svn/www/svn/etc/passwd.mn-${FORMATTEDDATE} && echo "Backup of passwd.mn created successfully." || echo "Failed to create backup of passwd.mn.";

        for i in "$@"
        do
                /usr/local/apache2/bin/htpasswd -D /usr/svn/www/svn/etc/passwd.mn $i;
        done

fi