Shell Scripting: Delayed Execution of Echo Statements
Is there any way to run multiple echo statements one after the other with a delay?
For example:
The first statement would be:
echo Hello1
after 1/2 second, run the second echo expression:
echo Hello2
Likewise, is it possible to run multiple statements one after the other with a time delay without printing all the echoes at once?
+3
source to share
3 answers
Perhaps you would like to use sleep <number of seconds>
For example sleep 60
to wait a minute.
eg. run from command line
$echo 'hello1'; sleep 2; echo 'hello2'
or in a bash script file (myscript.sh)
#!/bin/bash
echo 'hello1'
sleep 2
echo 'hello2 after 2 seconds'
sleep 2
echo 'hello3 after 2 seconds'
+4
source to share