I'm putting together a simple backup script that will tar contents of a folder, then move that file to a backup server. The script makes sure that the tar file exists and is not zero bytes before moving around.
The problem is that the script is dying on one of the IF lines
if [ -f /www/archives/pdf/pdf_201207021048.tar && 11294720 -gt 0 ]; then echo "tar file exists and is greater than 0 bytes." else echo "tar file does not exist or is zero bytes" fi
The error in the console is:
./backup_pdf.sh: line 49: [: missing `]'
Line 49 is the if statement above.
The script is successfully verified with
sh -n backup.sh
What's wrong that
sh is seeing a missing ']', yet it passes the syntax check?