I am trying to audit a file against a static base file that resides on the machine (the static base file resides on the machine). My output should have the NUMBER OF FILES and THE NAME OF THE FILES DO NOT MATCH. This is for multiple directories.
Here is what I have and below that is the error.
HELP????
----------Start of Script--------------------
#!/bin/ksh
FILELIST=/DJ/PUB/testfile
typeset -i MISSING=0
typeset -i FOUND=0
typeset -i TOTAL=0
while read -r FILELIST
do
echo ${FILELIST}
if [ ! -f ${FILELIST} ]
then
((MISSING +=1))
print -u2 "ERROR: File Missing: ${FNAME} Files Missing $MISSING"
else
((${FOUND} +=1))
fi
(( TOTAL += 1 ))
done < ${FILELIST}
then
if [ ${MISSING} ]
if [ ${MISSING} ]
then
print -u2 "Of the ${TOTAL} files expected, ${MISSING} were missing!"
else
print "All ${TOTAL} files were found!"
fi
------End Of Script------------
------Start of Error-------------
/REGO/LIBRARY/CAPCHANG
./christij 20: 0: not found
./christij 20: TOTAL: not found
/sdasdfREGO/LIBRARY/DBCHECK
./christij 20: MISSING: not found
ERROR: File Missing: Files Missing 0
./christij 20: TOTAL: not found
/REGO/LIBRARY/DBHTML
./christij 20: 0: not found
./christij 20: TOTAL: not found
/REGO/PREFS/CAPPRIME
./christij 20: 0: not found
./christij 20: TOTAL: not found
./christij 21: syntax error: got then, expecting Newline
-----------End Of Error--------------------------------
Is there a way for me to output the results to a file.
The end result should be an output file that will give the name of the machine..Example
On Machine Alpha
You have 2 missing files, they are /Dir/Subdir/missingfile, /Dir/Subdir/Missingfile2
Please help..
Here is what I have and below that is the error.
HELP????
----------Start of Script--------------------
#!/bin/ksh
FILELIST=/DJ/PUB/testfile
typeset -i MISSING=0
typeset -i FOUND=0
typeset -i TOTAL=0
while read -r FILELIST
do
echo ${FILELIST}
if [ ! -f ${FILELIST} ]
then
((MISSING +=1))
print -u2 "ERROR: File Missing: ${FNAME} Files Missing $MISSING"
else
((${FOUND} +=1))
fi
(( TOTAL += 1 ))
done < ${FILELIST}
then
if [ ${MISSING} ]
if [ ${MISSING} ]
then
print -u2 "Of the ${TOTAL} files expected, ${MISSING} were missing!"
else
print "All ${TOTAL} files were found!"
fi
------End Of Script------------
------Start of Error-------------
/REGO/LIBRARY/CAPCHANG
./christij 20: 0: not found
./christij 20: TOTAL: not found
/sdasdfREGO/LIBRARY/DBCHECK
./christij 20: MISSING: not found
ERROR: File Missing: Files Missing 0
./christij 20: TOTAL: not found
/REGO/LIBRARY/DBHTML
./christij 20: 0: not found
./christij 20: TOTAL: not found
/REGO/PREFS/CAPPRIME
./christij 20: 0: not found
./christij 20: TOTAL: not found
./christij 21: syntax error: got then, expecting Newline
-----------End Of Error--------------------------------
Is there a way for me to output the results to a file.
The end result should be an output file that will give the name of the machine..Example
On Machine Alpha
You have 2 missing files, they are /Dir/Subdir/missingfile, /Dir/Subdir/Missingfile2
Please help..