Why would the following script give following errors :./check1.sh: line 10: Hi,: command not found  ./check1.sh: line 21: syntax error: unexpected end of filecheck1.sh:#!/bin/bashsubj=host `hostname`healthcheckstatus=$(curl -s -o /dev/null -w '%{http_code}' http://localhost)body=Hi, Application is upbody1=Hi, Application is downmailbody=$([ $applicationstatus == 200 ] && $body || $body1)if [ $healthcheckstatus != 200 ]thenmail -s $subj me@domain.com <<EOS`echo -e $mailbody`EOSfiecho email subject ::$subjecho email body ::$mailbody
Bash command not found error
shell;shell script
The line assigning mailbody is wrong. You're calling the contents of $body and/or $body1 as a shell command line.Replacemailbody=$([ $applicationstatus == 200 ] && $body || $body1)With[ $applicationstatus = 200 ] && mailbody=$body || mailbody=$body1