#!/bin/sh
exist=`grep $1 /etc/passwd`
if [ -n $exist ];then
echo "$1 already exist"
exit 0
fi
if [ `whoami` = "root" ];then
useradd $1
else
echo "Must be roo"
exit 1
fi
exist=`grep $1 /etc/passwd`
if [ -n $exist ];then
echo "$1 already exist"
exit 0
fi
if [ `whoami` = "root" ];then
useradd $1
else
echo "Must be roo"
exit 1
fi
exist=`mysql -uUSER -pPASS -Dyour_db -e "select user from your_table where user='$1'"`
if [ -n $exist ];then
echo "$1 already exist"
exit 0
else
mysql -uUSER -pPASS -Dyour_db -e "insert into ....."
fi