Keep in mind that i am very new to bash(about 3 days in), I'm trying to count the amount of files in a specific directory and check if there are more than 5 files, But when I run the code below I get back a value type mismatch error and I can't figure out how to either fix it or run different code that accomplishes the same thing. Any Tips or fixes?
I tried to convert the variable by re-assigning it through a math equation I also tried to search for something like this but couldn't find anything
cd /mnt/Backlog/MSFB #Change into directory to count files
backupCount= find . -type f | wc -l #Count files and store in a variable
if [ backupCount -ge 5 ];
then
echo "More than 5 archives found!"
else
echo "Testing"
fi
What I want is the if statement to check the value of backupCount and if it's higher than 5 to display a message (for testing purposes) What I got was an error that said: backupCount: integer expression expected