The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Clock in Unix using awk alex_omul UNIX for Dummies Questions & Answers 4 04-02-2008 03:07 AM
changing sys clock (PST to UTC) OFFSIHR UNIX for Advanced & Expert Users 5 11-24-2006 02:25 AM
sincronization clock unix with windows server.. chanfle UNIX for Dummies Questions & Answers 4 04-11-2006 03:18 PM
Clock Trouble LolapaloL UNIX for Dummies Questions & Answers 2 11-09-2001 09:47 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-05-2000
Registered User
 

Join Date: Oct 2000
Posts: 42
Hi,
Anyone ever write a unix clock program that display the clock out in 7 segment LCD style.

I tried doing one with case statements:

!/usr/bin/ksh
clock=`date`
case $clock in
#This prints out the number 0
0)
echo " -"
echo "| |"
echo
echo "| |"
echo " -"
;;

#This prints out the number 1
1)
echo
echo "|"
echo
echo "|"
echo

Etc, to the rest of the number 2-9.
But I want the clock to print out line by not number by number.(5 lines) All with "-" and "|".
Including military format, hours, minutes, seconds.
So I thought of doing some sort of for loop which would have to execute 6 times(2 for every set - hours,minutes,seconds)
I am really confused.

Thanks,

A
Forum Sponsor
  #2  
Old 11-05-2000
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
Not sure <I>why</I> you would want to do this, but anyway...


You could probably get clever with Ansi escape codes to move
the cursor around for you:

echo "\033[<STRONG>R</STRONG>;<STRONG>C</STRONG>H"

Puts the cursor at row <STRONG>R</STRONG> and column <STRONG>C</STRONG>

See <A HREF="http://www.linux.org/docs/ldp/howto/Bash-Prompt-HOWTO-6.html">http://www.linux.org/docs/ldp/howto/Bash-Prompt-HOWTO-6.html</A> for some more examples.

  #3  
Old 11-08-2000
Registered User
 

Join Date: Oct 2000
Posts: 42
What I am trying to do is print out my time(date) line by line so if the time was 09 23 21
it would come out like(that's the first 2 lines) just to give you an idea.

- - - - -
| | | | | | | |

I've tried using a for loop that excutes 6 times one for every number, then have another for loop that executes 5 times for the number of lines, then have case statements that echo the "-" or the "|" but I can't seem to get it going. I tried using 10 case statements 0-9 but I ain't getting anywhere.

Thanks,

A
  #4  
Old 11-08-2000
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
You should use figlet for this:
http://st-www.cs.uiuc.edu/users/chai/figlet.html

Source code is available, if you like. There are webified versions if you dont feel like downloading and installing.

Code:
 _     ___         ___   ___         ___   ___  
  |       |   |       | |  /|   |   |  /| |   | 
  +    -+-         -+-  | + |       | + |  -+-| 
  |   |       |   |     |/  |   |   |/  |     | 
 ---   ---         ---   ---         ---   ---
  #5  
Old 11-08-2000
Registered User
 

Join Date: Oct 2000
Posts: 42
Thanks again,
but I need something hand coded and strictly in unix(bash)
scripting.
I am looking at this as an example but I'm getting the same
as I already have.

A
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0