日期:2014-05-16 浏览次数:20792 次
THEPASSWORD=ladofwind@123
n=0
echo "$THEPASSWORD"
------解决方案--------------------
grep -q "........"
if [ $? == 0 ]; then
echo [minimum 8 chars] yes
n=`expr $n + 1`
else
echo [minimum 8 chars] no
fi
echo "$THEPASSWORD"
------解决方案--------------------
grep -q "[0-9]"
if [ $? == 0 ]; then
echo [one numeric] yes
n=`expr $n + 1`
else
echo [one numeric] no
fi
echo "$THEPASSWORD"
------解决方案--------------------
grep -q "[^0-9a-zA-Z]"
if [ $? == 0 ]; then
echo [one special] yes
n=`expr $n + 1`
else
echo [one special] no
fi
if [ $n == 3 ]; then
echo password valid
else
echo password invalid
fi
#!/bin/sh
read -p 'Set your password(your password must contain a minimum of 8 chars with one numeric/special char.) ' password
if ! echo $password
------解决方案--------------------
egrep '[a-z]{7,}([0-9]
------解决方案--------------------
[!@#$%&^*]){1}' 1>/dev/null;then
echo "your password is invalid"
fi