当前位置: 技术问答>linux和unix
Shell的问题,来者有分,解决问题的小弟感激不尽!
来源: 互联网 发布时间:2015-12-29
本文导语: #!/bin/sh read -p "Enter a password:" pwd_entered echo Your typed in :$pwd_entered if [$pwd_entered="passwd"] then echo Password is correct else echo Password is incorrect if 运行SHELL Enter a password:password Your typed in :password ...
#!/bin/sh
read -p "Enter a password:" pwd_entered
echo Your typed in :$pwd_entered
if [$pwd_entered="passwd"]
then
echo Password is correct
else
echo Password is incorrect
if
运行SHELL
Enter a password:password
Your typed in :password
./if_eg.sh: line 7:[password=password]:command not found
Password is incorrect
请问改怎么改啊?
read -p "Enter a password:" pwd_entered
echo Your typed in :$pwd_entered
if [$pwd_entered="passwd"]
then
echo Password is correct
else
echo Password is incorrect
if
运行SHELL
Enter a password:password
Your typed in :password
./if_eg.sh: line 7:[password=password]:command not found
Password is incorrect
请问改怎么改啊?
|
#!/bin/sh
read -p "Enter a password:" pwd_entered
echo Your typed in :$pwd_entered
if [ "$pwd_entered" -eq "passwd" ]
#if(("$pwd_entered"=="passwd"))
then
echo Password is correct
else
echo Password is incorrect
fi
read -p "Enter a password:" pwd_entered
echo Your typed in :$pwd_entered
if [ "$pwd_entered" -eq "passwd" ]
#if(("$pwd_entered"=="passwd"))
then
echo Password is correct
else
echo Password is incorrect
fi