1. 程式人生 > >044_測試用戶名與密碼是否正確

044_測試用戶名與密碼是否正確

== bash success ech lse nbsp ash read bsp

#!/bin/bash
#用戶名為 tom 並且密碼為 123456,則提示登錄成功,否則提示登錄失敗

read -p "請輸入用戶名:" user
read -p "請輸入密碼:" pass
if [ "$user" == ‘tom‘ -a "$pass" == ‘123456‘ ];then
echo "Login successful"
else
echo "Login Failed"
fi

044_測試用戶名與密碼是否正確