我想做一个while循环,直到用户输入ab“@”,这是我的代码,但它不起作用:
echo -n "username(email): "
read username
checkEmail $username
checkEmail () {
username=$1
echo $username | grep "@"
while [ ! $? -eq 0 ] ; do
echo -n "username(email): "; read username
done
}
我想做一个while循环,直到用户输入ab“@”,这是我的代码,但它不起作用:
echo -n "username(email): "
read username
checkEmail $username
checkEmail () {
username=$1
echo $username | grep "@"
while [ ! $? -eq 0 ] ; do
echo -n "username(email): "; read username
done
}