i have this bash script code and i want to run the read command side by side with the while loop as the read command fetch data from user and save it in some file and the while loop do checking on a related something , so any suggestions like doing them in both terminals or something like that
Thanks
#!/bin/bash
trap "echo \"\" > /home/........./file.txt" SIGINT SIGTERM SIGHUP
while sleep 2
do
read -s -n 1 key
if [[ $key = "" ]]; then
echo >> somefile
else
echo "You pressed '$key'"
fi
clear
done
while sleep $sleepInterval
do
i=0
while read line
do
somecommands
done