对我来说,语法似乎写得正确,但我得到了第16行的错误....任何想法?第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
粘贴似乎已经搞乱了格式。下面是引擎收录链接:
http://shellcheck.net无法解析这个,但做出勇敢的尝试,试图解释它认为什么是接近。这可能会有所帮助。 –