循環被啓動,即使if語句確實還有這是沒有意義的,但我很新來砸所以沒有很多的事情是有意義的我用戶名和通行證登錄環慶典
first=0
echo enter your username
read user
log1=$(grep -q $user username_pass.txt)
echo enter your password
read pass
log2=$(grep -q $pass username_pass.txt)
if [ $log1=0 ] && [ $log2=0 ];
then
echo Welcome
first=1
fi
while [ $log1=1 ] || [ $log2=1 ];
do
echo wrong user name or password
echo enter your username
read user
echo enter your password
read pass
done
if [ $log1=0 ] && [ $log2=0 ] && [ first=0 ];
then
echo Welcome
fi
哪個'if'語句?你的問題不清楚。 –
這是一個重複的https://stackoverflow.com/questions/40442693/username-password-program-in-bash –
它不是一個重複其不同的問題在代碼的不同部分 –