I have a small section of code that reads a file, $FUNCTION_FILE which contains a list of function names in the format:
func1
func2
func3
It will read a line, run the function, and repeat until the file is done. Here is a snippet:
while read line; do
LINE_NUMBER=`expr $LINE_NUMBER + 1`
echo "LINE_NUMBER=$LINE_NUMBER"
$func
done <$FUNCTION_FILE
I've gotten into a situation where sometimes this section of code will stop reading the "$FUNCTION_FILE" before finishing and move on with the rest of the script. Sometimes it'll only read the first line and skip the rest, sometimes only the second line; I never see the "LINE_NUMBER=$LINE_NUMBER" message for the subsequent lines either.
Assuming that the file is correct, what are some things that could cause this issue I'm seeing?
exit
?$func
are. Please show us the actual functions you are running, there is no way we can help otherwise.