Need your help on below script where I am testing if file found at location /log/TestFile* and id there is only one file then it will display "File successfully Found" else "note found". my second condition - [ $sfCount == 1 ]; is not working. please help me with that.
sfCount=`ls -l /log/TestFile* | awk '{print $9}'| wc -l |sed "s/[[:blank:]]//g" | sed '/^$/d' | sed 's/\n//g'`
sFile=`ls -l /log/TestFile* | awk '{print $9}'`
if [ -e /log/$sFile ] && [ $sfCount == 1 ]; then
echo "File successfully Found"
exit 0
else
echo "File Not found"
exit 1
fi
echo "<$sfCount>"
to see what really is in the variable.