qfedu-linux-advanced-level/day1/d15.sh

17 lines
258 B
Bash
Raw Permalink Normal View History

2023-08-14 15:53:04 +08:00
#!/bin/bash
# -r 防止特殊字符被转义,例如 \n
read -r pwd1
read -r pwd2
echo "$pwd1 is zero string?"
[ -z "$pwd1" ]
echo $?
[ "$pwd1" = "$pwd2" ]
if [ $? -eq 0 ]
then
echo "pwd1 is equal to pwd2"
else
echo "pwd1 is not equal to pwd2"
fi