模拟用户登录的操作
1 # /bin/bash 2 3 echo -n login: 4 read name 5 echo -n password: 6 read passwd 7 8 if [ $name = "chat" -a $passwd = "abc" ]; then 9 echo "the host and passwdrd is right!" 10 else 11 echo "input is error!" 12 fi 13 14 #end
注意:if语句的格式: if [space judge_condition space]; then