I want to print the text in the following manner
Waiting for completion.
Waiting for completion..
Waiting for completion...
[Note :Not more than three dots]
The above should be in the same line and in a loop.
When the loop condition is false I want to get the following in the same line as well :
Waiting for completion... [OK]
How do I achieve this in bash script?
You should use carriage return. Search information in echo about \r.
for example maybe you want something like this:
#!/bin/bash
while [ 3 -gt 2 ];
do
echo -n -e 'Esperando.\r'
sleep 1
echo -n -e 'Esperando..\r'
sleep 1
echo -n -e 'Esperando...\r'
sleep 1
echo -n -e ' \r'
done
You need to sleep cause if you dont sleep you won't be able to watch the changing dots.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With