
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...
#
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!