Take the tour ×  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."     echo
"tar file does not exist or is zero bytes"  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?  share|improve this
question If you intend to use bash, you should use [[, not [.
Only use [ if you are scripting for POSIX sh. The Bash FAQ 31
explains the difference from [ and test. [[ is much safer and
more powerful. It's also part of bash syntax, whereas [ is a
command and not syntax, so bash -n ca