Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!csd4.milw.wisc.edu!uxc!uxc.cso.uiuc.edu!gistdev!jerry From: jerry@gistdev.UUCP Newsgroups: comp.unix.questions Subject: Re: Time for a prompt Message-ID: <8700003@gistdev> Date: 11 Jan 89 15:30:00 GMT References: <5251@whuts.ATT.COM> Lines: 40 Nf-ID: #R:whuts.ATT.COM:5251:gistdev:8700003:000:1322 Nf-From: gistdev.UUCP!jerry Jan 11 09:30:00 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@uxc.cso.uiuc.edu #include