#!/bin/bash

 

    while [ "$#" -lt "2" ]

      do

      echo "please give me userfile or passwdfile"

      exit 0

    done

 

touch $1 $2

    x=`cat $1 | wc -l`

    y=`cat $2 | wc -l`

    if [ "$x" -ne "$y" ];then

       echo "/mnt/userfile's line is different /mnt/passwdfile's line"

       exit 0

    else

       echo "             "

    fi

 

if id -u $1 >/dev/null;then

    echo "user exists"

    echo "           "

else

    useradd $1

    echo $2|passwd --stdin $1

fi