Stop blinking text after process is complete


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Stop blinking text after process is complete
# 1  
Old 03-18-2015
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.

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

# 2  
Old 03-19-2015
Try:
Code:
blink=$(tput blink) reset=$(tput sgr0)
printf "%s" "${blink}Archiving...${reset}"

See also this thread..
# 3  
Old 03-19-2015
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:-
Code:
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...
# 4  
Old 03-19-2015
Depending on your system's and terminal's capabilities, you could use console_codes (c.f. man) to e.g
Quote:
ESC 7 DECSC Save current state (cursor coordinates, attributes, character sets pointed at by G0, G1).
ESC 8 DECRC Restore state most recently saved by ESC 7.
and then overwrite the blinking string as wisecracker proposed. But all is lost if scrolling occurs and the position on screen is gone...
Use
Quote:
CSI r DECSTBM Set scrolling region; parameters are top and bottom row.
to limit the scrolling region.
# 5  
Old 03-19-2015
The IBM way (from mksysb etc.) is to draw dots on the screen.

It goes something like this:-
Code:
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 SmilieSmilieSmilie



Robin
# 6  
Old 03-19-2015
Quote:
Originally Posted by rbatte1
The IBM way (from mksysb etc.) is to draw dots on the screen.

It goes something like this:-
Code:
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 SmilieSmilieSmilie



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.)
# 7  
Old 03-19-2015
Code:
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?

Code:
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?

Last edited by wyclef; 03-19-2015 at 05:07 PM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need generic command to get complete running process details

I am on SunOS and Linux I need generic command to get complete process details from which i will eventually extract socket details (listen address and port) ps -ef | ggrep -i server | ggrep -i mydomaindoes not yield a process that should have both the grep entries along with the listen... (8 Replies)
Discussion started by: mohtashims
8 Replies

2. Shell Programming and Scripting

Script that waits for process to complete

Hello, I am in need of running an executable provided by a vendor that basically syncs files to a db. This tool can only be run against one folder at a time and it cannot have more than one instance running at a time. However, I need to run this tool against multiple folders. Each run of the... (5 Replies)
Discussion started by: vipertech
5 Replies

3. Shell Programming and Scripting

Waiting for a process to complete in shell script

Hi, I need to initiate a process script which will start and do some processing and then shuts down. Then i need to other verifications. But the the process takes around 25 to 3o minutes. One thing i can monitor the nohup.out file for this process where i can wait for shutting down statement to... (3 Replies)
Discussion started by: Prashanth19
3 Replies

4. UNIX for Dummies Questions & Answers

Stop the process

I have the following log file running since yesterday and its consuming so much of the disk space. -rw-rw-r-- 1 dev dba 4543237120 Nov 10 09:00 load_run_file1_0.1111091224.lg How do i kill this process. I don't have any idea of stopping this. Any help would be really appreciated. ... (3 Replies)
Discussion started by: bobby1015
3 Replies

5. Shell Programming and Scripting

Ensure file copy is complete before starting process

Hi experts, I have a requirement wherein a user is uploading a file to the Landing directory on one of our Linux servers. A cron job is scheduled to run after every 5 minutes which will pick up the files from the source (Landing) dir and copy to the target dir, and once successfully copied to... (4 Replies)
Discussion started by: adi_2_chaos
4 Replies

6. AIX

a process that never stop

Dears all i have an AIX box in which i am facing a problem with a process as below: /usr/dt/bin/dtexec -open 0 -ttprocid and each time i am killing this process with "kill -9" then it run again after a while. any ideas or solutions will be appreciated. (13 Replies)
Discussion started by: TheEngineer
13 Replies

7. Programming

blinking text

hi every one i got a problem in blinking text i tried like this main() { initscr(); move(5,10); addstr("this is blink->"); addch('H' | A_BLINK); refresh(); getch(); endwin(); } an error came like this # cc r3.c r3.c: In function ‘main': r3.c:6: error: ‘A_BLINK' undeclared (first... (5 Replies)
Discussion started by: ramesh.jella
5 Replies

8. Shell Programming and Scripting

Wait for Background Process to complete

I am attempting within a for-loop, to have my shell script (Solaris v8 ksh) wait until a copy file command to complete before continueing. The specific code is: for files in $(<inputfile.lst) do mv directory/$files directory/$files ksh -m -i bg %% wait $! done I am shaky on the... (3 Replies)
Discussion started by: gozer13
3 Replies

9. Shell Programming and Scripting

PERL: wait for process to complete

I'm using PERL on windows NT to try to run an extract of data. I have multiple zip files in multiple locations. I am extracting "*.t" from zip files and subsequently adding that file to one zip file so when the script is complete I should have one zip file with a whole bunch of ".t" files in it. ... (2 Replies)
Discussion started by: dangral
2 Replies

10. Filesystems, Disks and Memory

some process writin file - check if complete

Hi folks... some process is writing a file.... as soon as the process starts the file comes there, and its growin.. now i in another script want to ftp the file. i don't know if the file is complete or not. the process which writes the file is some other application and hence can't... (0 Replies)
Discussion started by: sade
0 Replies
Login or Register to Ask a Question