Technology Innovation - Blog para Programadores Esta é uma ideia que surgiu para divulgar as possíveis soluções que possam facilitar a vida aos programadores
terça-feira, julho 10, 2012
LINUX: Exemplo de script com repetição
process () {
echo "Hi, I'm sleeping for 5 seconds..."
sleep 5
echo "all Done."
echo "repeat again"
process
}
process
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:
sleep NUMBER[SUFFIX]
Where SUFFIX may be:
1.s for seconds (the default)
2.m for minutes.
3.h for hours.
4.d for days.
To sleep for 5 seconds, use:
sleep 5
To sleep for 2 mintus, use:
sleep 2m
sleep Command Bash Script Example
#!/bin/bash
echo "Hi, I'm sleeping for 5 seconds..."
sleep 5
echo "all Done."
sleep NUMBER[SUFFIX]
Where SUFFIX may be:
1.s for seconds (the default)
2.m for minutes.
3.h for hours.
4.d for days.
To sleep for 5 seconds, use:
sleep 5
To sleep for 2 mintus, use:
sleep 2m
sleep Command Bash Script Example
#!/bin/bash
echo "Hi, I'm sleeping for 5 seconds..."
sleep 5
echo "all Done."
Subscrever:
Mensagens (Atom)