Shell脚本中的Nested-If语句

har*_*ari 0 unix shell nested-if

这是我的脚本:

echo "Name"

read name

if [ "$name" == "abcd" ]; then

 echo "Password"

 read password

 if [ "$password == "pwd" ]; then

  echo "Hello"

 else

  echo "Wrong password"

 fi

else

 echo "wrong username"

fi
Run Code Online (Sandbox Code Playgroud)

这是我运行时得到的输出:

sh hello.sh

Name

abcd

hello.sh: line 14: unexpected EOF while looking for matching `"'

hello.sh: line 16: syntax error: unexpected end of file

这里有什么想法吗?这可能是一个非常愚蠢的,但我浪费了将近一个小时.

cni*_*tar 7

if [ "$password == "pwd" ]; then
Run Code Online (Sandbox Code Playgroud)

"之前有一个无与伦比的$password