意外令牌附近的语法错误' fi',bash脚本

时间:2015-05-01 18:15:24

标签: bash

我试图编写一个bash脚本来将用户输入的答案转换为MD5并将其与MD5哈希进行比较我已经看过它是否相同,但我得到了语法错误

Syntax error near unexpected token 'fi'

代码:

#!/bin/bash
# Check if you're right!
declare -x answer=6f22bf74918703932091343ba9c64402
echo "Enter your answer, follow by [ENTER]:"
read userAnswer
md5sum userAnswer > hashedAnswer 
if [ answer == hashedAnswer ] 
then
    echo "Correct! You're right! It was him! Maybe I shou----"
    echo "-You get run over, silenced before you can present your proof-"
else
    echo "Wrong, try again!"
fi

非常感谢任何帮助。

0 个答案:

没有答案