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
Shell program to accept multiple request at the same time tcskurra Shell Programming and Scripting 3 06-05-2008 12:29 PM
clock change markab2 UNIX for Advanced & Expert Users 0 10-31-2007 07:58 AM
Implementing "Time Limited, Trial" version of my program the_learner UNIX for Advanced & Expert Users 4 06-07-2007 06:46 AM
C program in Unix / Linux - Time differences chprvkmr High Level Programming 11 09-09-2005 01:46 AM
running a program for a specified time prosputko High Level Programming 3 07-06-2005 02:39 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-03-2003
Ben070371 Ben070371 is offline
Registered User
  
 

Join Date: Nov 2003
Posts: 5
time clock program

How would you write a program that would continually show the time in HOURS:MINUTES on an ASCII terminal(not just xclock)?
  #2 (permalink)  
Old 12-03-2003
kduffin's Avatar
kduffin kduffin is offline Forum Advisor  
UN1X
  
 

Join Date: Nov 2003
Location: Maryland
Posts: 449
An ascii terminal that you continue to type on? You could write the program using UNIX curses/ansiC. Do a 'man curses'.

Cheers,

Keith
  #3 (permalink)  
Old 12-03-2003
norsk hedensk norsk hedensk is offline Forum Advisor  
Registered User
  
 

Join Date: Jul 2002
Location: new york
Posts: 1,025
you could also include the time as a PS1 variable to alter your prompt, however this is not continually updated, so your time will not be refreshed until you hit enter.
  #4 (permalink)  
Old 12-04-2003
cassj's Avatar
cassj cassj is offline VIP Member  
Supporter
  
 

Join Date: Jul 2003
Location: Interweb
Posts: 109
I'm not sure exactly how you want to use what you're talking about, but you could do something goofy like this (saving the script as "showtime.sh" ):
Code:

#!/bin/sh
clear
date +"%r"
sleep 1
/Users/$USER/bin/showtime.sh

-Cassj

Last edited by cassj; 12-04-2003 at 10:00 PM..
  #5 (permalink)  
Old 12-05-2003
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,409
Danger!

Re: cassj's script - might cause system slowdown. The last line will launch a new process without terminating the current process, ie. after ten minutes you will have 600 processes all running showtime.sh.
  #6 (permalink)  
Old 12-05-2003
cassj's Avatar
cassj cassj is offline VIP Member  
Supporter
  
 

Join Date: Jul 2003
Location: Interweb
Posts: 109
Unhappy

Thanks Ygor. Sorry if I inadvertently wrote a virus :-( How about this:
Code:

#!/bin/sh
while [ 0 = 0 ] ; do
  clear
  date +"%r"
  sleep 1
done

I'm not a UNIX expert. I guess I know enough to be dangerous ;-P I couldn't find a way yet to make an infinite loop except for something like the "while" statement above. I'm using the default terminal in Mac OS X (10.3.1) Panther. Regards, Cassj
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




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


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0