I have the following line that reads telemetry data from a logfile when File: or
+ is encountered. I am setting the variable action to either
continue or
break, then running the command after the last
+ entry. It seems a bit confusing when the action gets executed upon reaching
(*). What can I do to make the intent clear?
Code:
action="continue"
while IFS= read -r telemetry; do
attrib="${telemetry%[[:blank:]]*}"
case $attrib in
("File:")
# "File:" field name has been reached.
field="File" ; action="break" ;;
("+")
# Detected the + continuation character
[[ "$field" == "File" ]] && action="break" ;;
(*)
# action="continue"
# Ends current iteration, resuming at next iteration.
# Read next line in logfl, because "File" not yet reached.
# action="break"
# Ends current iteration, exiting from the while loop.
# Exit logfl reading after end of field "File".
$action ;;
esac
done < "$logfl"