Bash command to wait for seconds


bash script wait for x minutes example

In order to make the bash script wait for n number of seconds you can make use of the sleep command,

Example:
# sleep 3

If you run the above command, it will wait for 3 seconds before you are returned to the prompt.

Bash script Example:
#!/bin/bash
#Bash command to wait for seconds

for (( i=1; i<=10; i++ ))
do
  echo "Waiting for 5 seconds..." 
  sleep 5
done
Output:
Sleeping for 5 seconds...
Sleeping for 5 seconds...
...
...
Sleeping for 5 seconds...
#


















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap