acctmod-bugzilla.sh

acctmod-bugzilla.sh

#!/bin/sh
if [ "$1" = "" ]; then exit 1 ; fi
if [ "$2" = "" ]; then exit 1 ; fi
n1=`expr index $1 "@"`
if [ $n1 = 0 ]; then exit 1 ; fi
n2=`expr index $2 "@"`
if [ $n2 = 0 ]; then exit 1 ; fi 
cou1=`mysql -u root -p*** -e "use bugs; select count(*) from profiles where login_name = '$1'" | sed -n '2p';`
if [ "$cou1" -eq "0" ]; then exit 1 ; fi

cou2=`mysql -u root -p*** -e "use bugs; select count(*) from profiles where login_name = '$2'" | sed -n '2p';`
if [ "$cou2" -eq "0" ]
then
mysql -u root -p*** -e "use bugs; update profiles set login_name = '$2' where login_name = '$1';"
echo "login_name: $1 -> $2"
fi

你可能感兴趣的:(acctmod-bugzilla.sh)