How do I pause for 5 seconds or 2 minutes in my bash shell script?
You need to use the sleep command to add delay for a specified amount of time. The syntax is as follows:
To sleep for 2 mintus, use:
echo "Hi, I'm sleeping for 5 seconds..."
sleep 5
echo "all Done."
You need to use the sleep command to add delay for a specified amount of time. The syntax is as follows:
sleep NUMBER[SUFFIX]
Where SUFFIX may be:- s for seconds (the default)
- m for minutes.
- h for hours.
- d for days.
sleep 5
To sleep for 2 mintus, use:
sleep 2m
sleep Command Bash Script Example
#!/bin/bashecho "Hi, I'm sleeping for 5 seconds..."
sleep 5
echo "all Done."
No comments:
Post a Comment