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)
, but it says -bash: syntax error near unexpected token '1'
. How can it be done?
Use the sleep
command.
Example:
sleep .5 # Waits 0.5 second.
sleep 5 # Waits 5 seconds.
sleep 5s # Waits 5 seconds.
sleep 5m # Waits 5 minutes.
sleep 5h # Waits 5 hours.
sleep 5d # Waits 5 days.
One can also employ decimals when specifying a time unit; e.g. sleep 1.5s