Something that has puzzled me for quite som time now is how I could create a progress indicator in bash.
You know when you're executing a long-running command and the command prints out dots, or a rotating dash, to show you that it's still working.
I was thinking about something like this:
echo -n "Working"
while (downloading a file or maybe searching for a file); do
echo -n "."
echo " Done"
The above example would not work since the command is performed and if it succeeds then echo a dot, sleep for one second and return to the beginning of the loop and run the command again...
I've also tried with a variable and a function run in the background.
When the function is finished it would change the variable and this would cause the loop to finnish, but this didn't work either...
Does anyone have a working solution for this?
Thanks in advance!