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}"
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}"