Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 02 Oct 2014, 02:37
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Process timer
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count_1  
Author Message
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Sun 31 Oct 2010, 14:24    Post_subject:  Process timer  

Name: "timer"

Adds a process timer to script. Add "timer &" before process, and "kill `pidof timer`" after.

Note: Also helps to add a newline after timer: 'echo -e "\nDone!"'

Code:

#!/bin/sh

#### begin with:  "timer & "
###  end with:    "kill `pidof timer` "
 

CYAN='\E[36;40m'

SEC="0"

echo -en $CYAN"\nWorking..............."
while [ "$0" ]; do
  for ((i=0;i<1000001;i++)); do
 
    SEC="$(( $SEC+1 ))"
 [ ${SEC} -gt 0 -a ${SEC} -lt 11 ] &&  echo -en "$SEC"   
 [ ${SEC} -gt 10 -a ${SEC} -lt 101 ] &&  echo -en "\b$SEC"   
 [ ${SEC} -gt 100 -a ${SEC} -lt 1001 ] &&  echo -en "\b\b$SEC"   
 [ ${SEC} -gt 1000 -a ${SEC} -lt 10001 ] &&  echo -en "\b\b\b$SEC"   
 [ ${SEC} -gt 10000 -a ${SEC} -lt 100001 ]  &&  echo -en "\b\b\b\b$SEC"   
 [ ${SEC} -gt 100000 -a ${SEC} -lt 1000001 ] &&  echo -en "\b\b\b\b\b$SEC"   
    echo -en "\b"
    sleep 1
   done
done
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count_1  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0380s ][ Queries: 12 (0.0057s) ][ GZIP on ]