寻找匹配的 `"' shell 脚本时出现意外的 EOF
Unexpected EOF while looking for matching `"' shell script
我明白了
./matrix: line 36: unexpected EOF while looking for matching `"'
./matrix: line 38: syntax error: unexpected end of file
当我尝试 运行 我制作的 shell 脚本时,我没有在第 36-38 行看到任何错误引用
脚本:
#!/bin/bash
RAND=$(( ( RANDOM % 10 ) + 1 ))
if [ $RAND == 1 ]
then
printf '\e[38;5;118m "Follow The White Rabbit"'|cowthink -f matrix
elif [ "$RAND" == 2 ]
then
printf '\e[38;5;118m "To deny our own impulses is to deny the very thing that makes us human."'|cowthink -f matrix
elif [ "$RAND" == 3 ]
then
printf '\e[38;5;118m "Neo, sooner or later you\'re going to realize just as I did that there\'s a difference between knowing the path and walking the path."'|cowthink -f matrix
elif [ "$RAND" == 4 ]
then
printf '\e[38;5;118m "You have to \let it all go, Neo. Fear, doubt, and disbelief. Free your mind."'|cowthink -f matrix
elif [ "$RAND" == 5 ]
then
printf '\e[38;5;118m "What are you waiting \for? You\'re faster than this. Don\'t think you are, know you are. Come on. Stop trying to hit me and hit me."'|cowthink -f matrix
elif [ "$RAND" = 6 ]
then
printf '\e[38;5;118m "I\'m trying to \free your mind, Neo. But I can only show you the door. You\'re the one that has to walk through it."'|cowthink -f matrix
elif [ "$RAND" == 7 ]
then
printf '\e[38;5;118m "
Tank\: So what \do you need? Besides a miracle.
Neo\: Guns. Lots of guns."'|cowthink -f matrix
elif [ "$RAND" = 8 ]
then
printf '\e[38;5;118m "You take the red pill - you stay \in Wonderland and I show you how deep the rabbit-hole goes."'|cowthink -f matrix
elif [ "$RAND" == 9 ]
then
printf '\e[38;5;118m "What is real? How \do you define \'real\'? If you\'re talking about what you can feel, what you can smell, what you can taste and see, \then \'real\' is simply electrical signals interpreted by your brain."'|cowthink -f matrix
elif [ "$RAND" == 10 ]
then
printf '\e[38;5;118m "Have you ever had a dream, Neo, that you were so sure was real? What \if you were unable to wake from that dream? How would you know the difference between the dream world and the real world?"'|cowthink -f matrix
fi
修复 '
的转义:将所有 \'
替换为 '\''
。
我明白了
./matrix: line 36: unexpected EOF while looking for matching `"'
./matrix: line 38: syntax error: unexpected end of file
当我尝试 运行 我制作的 shell 脚本时,我没有在第 36-38 行看到任何错误引用
脚本:
#!/bin/bash
RAND=$(( ( RANDOM % 10 ) + 1 ))
if [ $RAND == 1 ]
then
printf '\e[38;5;118m "Follow The White Rabbit"'|cowthink -f matrix
elif [ "$RAND" == 2 ]
then
printf '\e[38;5;118m "To deny our own impulses is to deny the very thing that makes us human."'|cowthink -f matrix
elif [ "$RAND" == 3 ]
then
printf '\e[38;5;118m "Neo, sooner or later you\'re going to realize just as I did that there\'s a difference between knowing the path and walking the path."'|cowthink -f matrix
elif [ "$RAND" == 4 ]
then
printf '\e[38;5;118m "You have to \let it all go, Neo. Fear, doubt, and disbelief. Free your mind."'|cowthink -f matrix
elif [ "$RAND" == 5 ]
then
printf '\e[38;5;118m "What are you waiting \for? You\'re faster than this. Don\'t think you are, know you are. Come on. Stop trying to hit me and hit me."'|cowthink -f matrix
elif [ "$RAND" = 6 ]
then
printf '\e[38;5;118m "I\'m trying to \free your mind, Neo. But I can only show you the door. You\'re the one that has to walk through it."'|cowthink -f matrix
elif [ "$RAND" == 7 ]
then
printf '\e[38;5;118m "
Tank\: So what \do you need? Besides a miracle.
Neo\: Guns. Lots of guns."'|cowthink -f matrix
elif [ "$RAND" = 8 ]
then
printf '\e[38;5;118m "You take the red pill - you stay \in Wonderland and I show you how deep the rabbit-hole goes."'|cowthink -f matrix
elif [ "$RAND" == 9 ]
then
printf '\e[38;5;118m "What is real? How \do you define \'real\'? If you\'re talking about what you can feel, what you can smell, what you can taste and see, \then \'real\' is simply electrical signals interpreted by your brain."'|cowthink -f matrix
elif [ "$RAND" == 10 ]
then
printf '\e[38;5;118m "Have you ever had a dream, Neo, that you were so sure was real? What \if you were unable to wake from that dream? How would you know the difference between the dream world and the real world?"'|cowthink -f matrix
fi
修复 '
的转义:将所有 \'
替换为 '\''
。