All,
I am new to shell scripting and trying to get the count of files that starts with error and with extension .out, if the count is greater than 0 and zip the file and send an email with the content of error.out file, here is my script
when I tried to execute above script I am getting below error
./test.ksh: line 2: find . -name *.out -print | wc -l: command not found
./test.ksh: line 2: testcount: command not found
Can someone please tell me what is wrong with this script?
I am new to shell scripting and trying to get the count of files that starts with error and with extension .out, if the count is greater than 0 and zip the file and send an email with the content of error.out file, here is my script
Code:
cd /temp
testcount =$('find . -name '*.out' -print | wc -l')
echo $testcount
if [[ $testcount -ne 0 ]]
then
zip error_log.zip *.out
cat error_*.out | mailx -s "for testing" username@doamin.com
exit 1
else
exit 0
fi
Moderator's Comments: | ||
|
when I tried to execute above script I am getting below error
./test.ksh: line 2: find . -name *.out -print | wc -l: command not found
./test.ksh: line 2: testcount: command not found
Can someone please tell me what is wrong with this script?