#!/bin/bash ############################### # Author: Neo<openunix@163.com # Home: http://netkiller.sf.net ############################### SVNROOT=/srv/svnroot/project adduser(){ echo $1 $2 if [ -z $1 ]; then usage else local user=$1 fi if [ -z $2 ]; then usage else local passwd=$2 fi echo "$1 = $2" >> $SVNROOT/conf/passwd } deluser(){ local user=$1 if [ -z $user ]; then usage else ed -s $SVNROOT/conf/passwd <<EOF /$user/ d wq EOF fi } list(){ cat $SVNROOT/conf/passwd } usage(){ echo $"Usage: $0 {list|add|del} username" } case "$1" in list) list ;; add) adduser $2 $3 ;; del) deluser $2 ;; restart) stop start ;; condrestart) condrestart ;; *) usage exit 1 esac
用法
./svnuser list ./svnuser add user passwd ./svnuser del user