Time for a prompt

jerry at gistdev.UUCP jerry at gistdev.UUCP
Thu Jan 12 01:30:00 AEST 1989


Per my copy of "The Korn Shell" by David G. Korn, The following is
suggested for getting time in your prompt.

NOTE: I am running on ATT 3.1 (Sys V) operating System
There is a comment "On BSD you need another command to initalize the
SECONDS variable."

---------Cut Here-----------------Cut Here-----------------Cut Here--------

#----------------------------------------------------------------#
#                         Prompt                                 #
#----------------------------------------------------------------#
# set up time kludge, thanks to David Korn                       #
typeset -RZ2 _x1 _x2 _x3			# R = real, Z = ?, 2 = ?
let SECONDS=$(date '+3600*%H+60*%M+%S')		# initialize SECONDS var
						# SECONDS updated by shell
_s='(_x1=(SECONDS/3600)%24)==(_x2=(SECONDS/60)%60)'
TIME='"${_d[_s]}$_x1:$_x2"'

HOST=`uname`; export HOST

PS1="$HOST!!Jerry($TIME)(!)-> "
PS2="-> "
unset HOST 
#----------------------------------------------------------------#

---------Cut Here-----------------Cut Here-----------------Cut Here--------


 -- 
Jerry Waltz	 Global Information Systems Technology, Inc.
		 1800 Woodfield Drive
		 Savoy, Illinois 61874-9505

Phone: (217) 352-1165
UUCP:    ...{uunet,convex,pur-ee}!uiucuxc!gistdev!jerry
INTERNET: jerry%gistdev at uxc.cso.uiuc.edu

#include <std_disclaimer>



More information about the Comp.unix.questions mailing list