高手给一 linux shell 小程序 要求完整无错的,最好有注释
3个回答
展开全部
#! /bin/bash
username=$1
pwd=$2
month=$3
if [ "$month" == "" ]; then
month="3"
fi
check=$(cat /etc/passwd | grep /$username:)
if [ $check ]; then
echo "User $username is already existed. Exit."
exit
fi
date=`date --date="+$month month" +"%Y-%m-%d"`
useradd -s /bin/false -e $date -M $username
echo "$username:$pwd" |chpasswd
echo "User created. Expired date for $username is $date"
追问
能稍微解释是下不
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询