!/bin/bash
# 为用户设置隐性密码
check_user()
{
if ! id oracle >/dev/null 2>&1
then
useradd oracle
fi
secceed=0
while [ "$secceed" = "0" ]
do
STTY=`stty -g`
stty -echo
echo -n "Enter user oracle password: "
read passw1
echo
while [ -z "$passw1" ]
do
echo "Password can not be empty"
echo -n "Enter user oracle password: "
read passw1
echo
done
echo -n "Duplication of password: "
read passw2
echo
while [ -z "$passw2" ]
do
echo "Password can not be empty"
echo -n "Duplication of password: "
read passw2
echo
done
if [[ "$passw1" != "$passw2" ]]
then
echo "Bad password,Two passwords does not match"
secceed=0
else
secceed=1
stty "$STTY"
echo "$passw2" | passwd --stdin oracle
fi
done
}
check_user
<!-- 日志内容 结束 --><!-- 日志来源 开始 --><!-- 日志来源 结束 --><!-- 日志信息 开始 -->