Assign grep count to variable
Found the issue
Its the assignment, this will work:
some_var=$(command)
While this won't work:
some_var = $(command)
Thank you for your help! I will accept first helpful answer.
To assign the output of a command, use var=$(cmd)
(as shellcheck automatically tells you if you paste your script there).
#!/bin/bash
some_var=$(grep -c "some text" /tmp/somePath)
echo "var value is: ${some_var}"