while true;do echo -n .;sleep 1;done &
sleep 10 # or do something else here
kill $!; trap 'kill $!' SIGTERM
this will start an infinite while loop that echos a spinner every second, executed in the background.
Instead of the
sleep10 command run any command you want.
When that command finishes executing this will kill the last job running in the background (which is the infinite while loop)
You can use various while loops instead, e.g. a spinner like this:
while :;do for s in / - \\ \|; do printf "\r$s";sleep 1;done;done