943,965 Members | Top Members by Rank

Ad:
0

Colorful clock of Time

by on Aug 8th, 2005
I know what your thinking, You and everyone else has always wanted a clock that sits at the top of your command prompt and tells you the time.

Why ?

I made this in first year when i spent countless hours programming and little in bed. I decided i needed somthing that told me all the things i needed to know in one easy location, the top of the screen.. So here it the pauls magical clock of sit on top of my screen.

Sorry about the lack of comments and meaningful varible names, its quite a hacked together little clock
Shell Scripting Code Snippet (Toggle Plain Text)
  1. ------------------------------------------------------ To use this ---------------------------
  2. Replace 2352318 with your userid (thats my user ID on the box at uni)
  3.  
  4. add this to your ~/.bashrc
  5.  
  6. ------------------------------------------------------------------------------------------------
  7.  
  8. clock=()
  9. {
  10. LENGTH_STRING=27;
  11. MAILEXISTS=`ls /var/mail | grep -c 2352318`;
  12. if [ $MAILEXISTS -eq "1" ]; then
  13. MSGCOUNT=`grep -c "From " $MAIL`;
  14. else
  15. MSGCOUNT=0;
  16. fi;
  17. col=`tput cols`;
  18. tput sc;
  19. tput cup 0 $(( $col - LENGTH_STRING ));
  20. echo -e -n "\033[1;36m";
  21. echo -n " Mail:[$MSGCOUNT] [";
  22. date +"%H:%M] [%e/%b]";
  23. tput rc
  24. }
  25.  
  26. PROMPT_COMMAND="clock"
Comments on this Code Snippet
Apr 12th, 2007
0

Re: Colorful clock of Time

Good but i can't find bash soft ware to run it
Newbie Poster
Mpiangu is offline Offline
8 posts
since Apr 2007
Message:
Previous Thread in Shell Scripting Forum Timeline: comparing versions
Next Thread in Shell Scripting Forum Timeline: Replacing text within a file using awk





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC