I am new to shell script. I create the below script to count the total lines of files in directory.
It looks simple. line 7 is giving the correct number for the file.
#!/bin/bash
totalCount=0;
count=0;
for f in "$1"/*
do
echo $(grep -o 'timestamp' "$f" | wc -l); #line 7
count = $(grep -o 'timestamp' "$f" | wc -l); #line 8
totalCount = totalCount + count; #line 9
done
echo $totalCount
however, line 8 and 9 keep giving below errors.
./myscript.sh: line 9: count: command not found
./myscript.sh: line 10: totalCount: command not found
I tried to change 'count' to '$count', still does not work.
What am i missing here?