巴什的回声:逃避撇号?

时间:2015-09-13 15:49:19

标签: bash escaping echo apostrophe

我正在尝试在引号内使用bash中的echo。 当我从命令行尝试时,它工作正常。

例如:echo "I'm testing the apostrophe functionality." 收益率I'm testing the apostrophe functionality.

然而,当我在脚本中写这个时,它似乎不起作用。

以下是我的代码片段:(我正在尝试将ASCII艺术集成到我的程序中)

if [ "$2" == "-s" ]

  then echo "   ___                           __ _             _            "
  echo "  / _ \__ _ _ __ ___   ___      / _\ |_ __ _ _ __| |_ ___ _ __ "
  echo " / /_\/ _` | '_ ` _ \ / _ \_____\ \| __/ _` | '__| __/ _ \ '__|"
  echo "/ /_\\ (_| | | | | | |  __/_____|\ \ || (_| | |  | ||  __/ |   "
  echo "\____/\__,_|_| |_| |_|\___|     \__/\__\__,_|_|   \__\___|_|   "
  echo ""                                                              
  echo "Hello!  My name is Siri."
  echo "I'm not actually the Siri you're probably used to."
  echo "I'm actually Apple's Siri's sister, the no-voice one."
  echo "Sorry, but I'm in development right now."
  echo "Come back later and maybe Eric will bring me out of beta."
  echo "Thanks for reading this long debug message!"
fi

我检查并仔细检查了所有引号......

然而它仍然产生:

./game-starter.sh: line 7: unexpected EOF while looking for matching ``'
./game-starter.sh: line 88: syntax error: unexpected end of file

请尽快帮忙!

-HewwoCraziness

0 个答案:

没有答案