Blinking Cursor on Bash Script
Clash Royale CLAN TAG#URR8PPP
Blinking Cursor on Bash Script
I was working on 1 bash script, where I have to wait for command to get completed.
I was looking if we can display blinking cursor until the command is completed in Bash script?
I saw there are some progress bar scripts already present here, but looking for something which can just blink and show terminal is still live.
Thanks in advance for your answers.
2 Answers
2
See following example:
$ cat blink.sh
#!/bin/bash
printf 'Working'
for ((i = 0; i < 5; ++i)); do
for ((j = 0; j < 4; ++j)); do
printf .
sleep 5
done
printf 'bbbb bbbb'
done
printf '....donen'
$
This is how it looks like when running:
Thanks looks great. How to integrate with command, so that it stops when command is finished.
– Pawan
Aug 10 at 9:24
just check some condition in the for loop. how do u manually check if the command is finished?
– pynexj
Aug 10 at 10:19
You can set the blink
attribute
blink
printf "$(tput blink)"
sleep 30
tput sgr0
Thanks for commenting. I tried on terminal, but it keeps on blinking.
– Pawan
Aug 10 at 6:47
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Cursor blinking is controlled by the terminal itself, not by your script. Blinking doesn't mean your script is alive, it means you have set up blinking at some point. You need to output something periodically.
– n.m.
Aug 10 at 8:28