Stop blinking text after process is complete

Trying to make some blinking text to designate a process taking place. Trying to figure out how when the process is complete how to end the blinking. I could clear out but then I lose any prior output which I don't want.

echo "Archiving Files..."
printf "\x1b[5mArchiving...\x1b[25m"
wait $!
tar -zcf $fileName.tar.gz
echo "Done!"

Try:

blink=$(tput blink) reset=$(tput sgr0)
printf "%s" "${blink}Archiving...${reset}"

See also this thread..

You could also put your blinking text smoewhere on screen in this case at line 23 in the middle and and overwrite it using terminal escape codes only:-

printf "\x1b[23;35f\x1b[5mArchiving...\x1b[0m"
sleep 5
#<your working code here>
printf "\x1b[23;35f\x1b[5m            \x1b[0m\x1b[23;1fArchiving finished...\n"

Ignore the "sleep 5" as it is just a delay to show this working...

Depending on your system's and terminal's capabilities, you could use console_codes (c.f. man ) to e.g

and then overwrite the blinking string as wisecracker proposed. But all is lost if scrolling occurs and the position on screen is gone...
Use

to limit the scrolling region.

The IBM way (from mksysb etc.) is to draw dots on the screen.

It goes something like this:-

while true
do
   echo ".\c"
   sleep 10
done &
PID=$!

# Your code here
sleep 50
# Your code ends

kill $PID

The dots are not actually connected to the processing, but it keeps the user happy ;):p:cool:

Robin

I am glad you mentioned the last line as I could see no way in which plotting dots on the screen would be related to any operational task in question. ;o)
Similary the OPs flashing text method. Both have the same flaw......

I wonder what happens if the operational task goes into some kind of strange locked up loop? (Rhetorical.)

blink=$(tput blink) reset=$(tput sgr0) 
printf "%s" "${blink}Archiving...${reset}"

This works... but the same as what I setup where after the process it keeps blinking. I'll check out some of the other responses.

actually, what if I were to do something like this?

blink=$(tput blink) reset=$(tput sgr0) printf "%s" "${blink}Archiving...${reset}\Archiving..."

that's not quite right but where I'm trying to replace the line with another line when the process is complete... how would I do that?

You cannot set variables local to a shell builtin command, like printf . You could do something like this perhaps:

blink=$(tput blink) reset=$(tput sgr0)
printf "%s" "${blink}"
some_utility
printf "%s" "${reset}"

By:

printf "%s\r" "Cursor is back at line start"

hth

---------- Post updated at 23:03 ---------- Previous update was at 22:57 ----------

Comes to mind, maybe i should provide an untar method for my tui-tar? (old screenshot, filesize is now centered, and status (ok/bad) in color.
During the 2nd example i pressed enter a few times, to show the 'animation' on the screenshot.

Seems there is a need for it?
Any suggestions? (ideas how to display the 'output' (progress) of untar'ing? )

Hi.

See also thread need suggestion how to use the progress bar while executing shell for some suggestions on over-writing, bars and spinners ... cheers, drl

Thanks guys! Lots to look over here...