script.sh

#!/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

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章