Using tail in a subshell in conjunction with while/break does not exit the loop
问题 I have been facing a very peculiar issue with shell scripts. Here is the scenario Script1 (spawns in background)--> Script2 Script2 has the following code function check_log() { logfile=$1 tail -5f ${logfile} | while read line do echo $line if echo $line|grep "${triggerword}";then echo "Logout completion detected" start_leaks_detection triggerwordfound=true echo "Leaks detection complete" fi if $triggerwordfound;then echo "Trigger word found and processing complete.Exiting" break fi done echo