Hi
I ahve the below script.. though i am getting the requried result, i am geeting the below error while executing the below script
#!/bin/sh
#
diff -b -w ${1} ${2} > ${1}.diff
if [[ $? -eq 0 ]] ; then
echo "Added: "
diff -b -w ${1} ${2} | grep "^< "
echo "Removed: "
diff -b -w ${1} ${2} | grep "^> "
else
echo "Files were added/removed"
fi;
done < ${1}.diff
rm $\{1\}.diff
error:
/home/cvs/gkc ->diff1.sh 2048files.txt 2047files.txt
Files were added/removed
diff1.sh[12]: syntax error at line 12 : `done' unexpected
can some one correct me...
RTM
September 20, 2006, 8:12am
2
When using a for, while, or until loop, you would end those with done. Since you have none of those loops, there is no reason to have a done closing statement.
now if i remove the "done"
i get the belwo error..
/home/cvs/gkc ->diff1.sh 2047sourcefiles.txt 2048sourcefiles.txt
Files were added/removed
diff1.sh[12]: 2047sourcefiles.txt.diff: cannot execute
my script looks like
#!/bin/sh
#
diff -b -w ${1} ${2} > ${1}.diff
if [[ $? -eq 0 ]] ; then
echo "Added: "
diff -b -w ${1} ${2} | grep "^< "
echo "Removed: "
diff -b -w ${1} ${2} | grep "^> "
else
echo "Files were added/removed"
fi;
${1}.diff
rm $\{1\}.diff
anbu23
September 20, 2006, 10:54am
4
${1}.diff #what do you want to do in this line
# if you want to display use cat or remove that line