【发布时间】:2015-08-28 15:08:24
【问题描述】:
对我来说,语法似乎写得正确,但我在第 16 行遇到错误......有什么想法吗?
#!/bin/sh
#This is script is meant to be an add on to another one I'm using. Based on the return code output it will mail me the message.
read -p "What is the file name? " variable
rc = $?
ls -al $variable
if [[ $rc != 0 ]]; then
mail -s "$variable script did not complete" email address -- -f email address \
<< EOF Your script has failed with error code $rc << EOF;
elif [[ $rc = 0 ]]; then
mail -s "Your script completed" email address -- -f email address \
<< EOF Your script completed with error code $rc. << EOF;
fi
粘贴似乎有点弄乱了格式。这是 pastebin 链接:
【问题讨论】:
-
shellcheck.net 无法解析此内容,但勇敢地尝试并解释了它认为接近的内容。这在这里可能会有所帮助。