Ok so I have a simple script that has the structure down below. I have this sub process that will run for an indefinite amount of time. As of now, it will only stop when the user kills the process manually. I was wondering if there is a way to listen for input from the user without getting stuck on a read line. In other words, while the sub process is running, in the background, see if the user types "quit\n" in the terminal.
...
if [[ option = "3" ]]; then
while [2 -lt 4]; #THIS IS WHERE I WANT TO CHANGE TO LISTENING FOR INPUT TO QUIT
#Some sub process that continues to run
done
fi
....
Thanks for the help! Sorry if this is badly worded, I couldn't think of a better way to describe the issue. As for my brainstorming attempts, I know can just use a variable in the while condition and say do this until it equals "quit", but setting that variable to the input is where I get lost.