I want to make my script wait for n seconds, during which user can abort the script. My code till now looks like this
echo "Start Date provided :" $STARTDATE
echo "End date provided :" $ENDDATE
echo ""
echo "Please check the dates provided and in case of error press CTRL+C"
seq 1 15 |while read i; do echo -ne "\rWaiting for $i seconds"; sleep 1; done
echo ""
echo "Executing query on the remote side, please wait..."
When the user presses ctrl+c though what happens is that the while loop ends and continues executing the rest of the script.
How can I make it abort the entire script? Thanks in advance for any advise