Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!csd4.milw.wisc.edu!uxc.cso.uiuc.edu!uxc.cso.uiuc.edu!m.cs.uiuc.edu!bradley!vijay From: vijay@bradley.UUCP Newsgroups: comp.unix.questions Subject: Re: Getting UNIX time from the shell Message-ID: <10800028@bradley> Date: 14 Jun 89 15:28:00 GMT References: <1343@cbnewsh.ATT.COM> Lines: 53 Nf-ID: #R:cbnewsh.ATT.COM:1343:bradley:10800028:000:1592 Nf-From: bradley.UUCP!vijay Jun 14 10:28:00 1989 Ihor Kinal writes:--> >/* ---------- "Getting UNIX time from the shell" ---------- */ >Is there any way that I can use the date command to display the >actual UNIX time??? [...] >YES, I KNOW I CAN DO THIS WITH A SIMPLE 7 LINE C PROGRAM - BUT >CAN I DO THIS WITH JUST SHELL COMMANDS?? [...] >Ihor Kinal >cbnewsh!ijk >{att!violin!ijk} You do not need to write a C program to do that. A one liner shell command will do it for you (In C Shell or Bourne Shell). All you need is : date | cut -f4,5 -d" " That will give you the time. If it's a hassle having to type that command whenever you want the time, add this to your .profile : time=`date | cut -f4,5 -d" "` export time or if you are using C shell, add this to your .login : setenv time `date | cut -f4,5 -d" "` Or alternatively you can create a shell file called time with the command date | cut -f4,5 -d" " Then make that file executable and you will be set. Take your pick...... =============================================================I / / E-mail: vijay@bradley.edu I / / * * ___ ...!uiucdcs!bradley!vijay I / / / / / / / / I===================================I //___/___/__/_\/__/__/ I Exxon - Our gasoline contains no / / I sea water. Guaranteed!! / / I __/ __/ I ===============================================================