I have the following loop which counts from 0 till 99:
#!/bin/bash
for ((i=0;i<100;i++));
do
echo $i
sleep 1
done
Is there a way to change the result of the output from terminal while this loop script is running. Lets say if I press letter k the loop automatically add 10 more number to the current number, so if we have 10 being displayed on the screen and we press K the loop should automatically change to 20! Thanks
trap
to trap certain signals or reading user input (read
command ) in your script and modify your script to act according to the input. – rahul Apr 4 at 18:16