I have the following shell script. The purpose is to loop thru each line of the target file (whose path is the input parameter to the script) and do work against each line.
This was happening to me because I had set -e and a grep in a loop was returning with no output (which gives a non-zero error code).
set -e
grep