Can somebody help me debug this simple script. Been trying for 2 hrs now but I cant seem to get it to work.
#!/bin/bash
echo "Search for MMSC or WAP connectivity errors"
sftpErrorCount=$(tail -100 3_ERRORs_log.txt | grep "MMSC_Upload2" | grep "Fail to copy"| awk '{print $1 " " $2" " $3" " $4}'| wc -l)
if [ "$sftpErrorCount" -gt 0 ]
then
sftpErrorDate=$(tail -100 3_ERRORs_log.txt | grep "MMSC_Upload2" | grep "Fail to copy"| awk '{print $1 " " $2" " $3" " $4}'| tail -1)
echo "Error found at around $sftpErrorDate please check FTP logs"
else
echo "No errors found"
Error when I execute the script
sh test_script.sh
Search for MMSC or WAP connectivity errors
test_script.sh: line 14: syntax error: unexpected end of file