-1

Here's my script

#! /bin/sh

source=/Source/$1
destination=/Destination
folderParam=$(basename $source)
if /usr/bin/rsync -avh -r $source $destination; then
   cp /FolderCopyStatus/Success   /Status/Success_$folderParam;
   mysql -h ip -uroot -ppassword  << EOF
   use oct_test;
   insert into Test(Name,Value,Status) values('rsync',$folderParam,'Ok');
   EOF
else
   cp /FolderCopyStatus/Failure   /Status/Failure_$folderParam;
   mysql -h ip  -uroot -ppassword  << EOF
   use oct_test;
   insert into Test(Name,Value,Status) values('rsync',$folderParam,'Fail');
   EOF
fi

Error and Warning

/FinalSync.sh: line 18: warning: here-document at line 8 delimited by end-of-file (wanted `EOF') /FinalSync.sh: line 19: syntax error: unexpected end of file

I know there is a simple thing that I am missing.Newbie to shell scripting.

HDev007
  • 261

1 Answers1

1

EOF should be placed on the start of line. Otherwise bash does not match EOF, it sees "spaces EOF".

Kalavan
  • 666