I have only found how to wait for user input. However, I only want to pause so that my while true
doesn\'t crash my computer.
I tried pause(1)
use trap
to pause and check command line (in color using tput
) before running it
trap 'tput setaf 1;tput bold;echo $BASH_COMMAND;read;tput init' DEBUG
press any key to continue
use with
set -x
to debug command line
I realize that I'm a bit late with this, but you can also call sleep and pass the disired time in. For example, If I wanted to wait for 3 seconds I can do:
/bin/sleep 3
4 seconds would look like this:
/bin/sleep 4
Run multiple sleeps and commands
sleep 5 && cd /var/www/html && git pull && sleep 3 && cd ..
This will wait for 5 seconds before executing the first script, then will sleep again for 3 seconds before it changes directory again.
Within the script you can add the following in between the actions you would like the pause. This will pause the routine for 5 seconds.
read -p "Pause Time 5 seconds" -t 5
read -p "Continuing in 5 Seconds...." -t 5
echo "Continuing ...."