Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!xanth!hoptoad!dasys1!jpr From: jpr@dasys1.UUCP (Jean-Pierre Radley) Newsgroups: comp.unix.questions Subject: Re: slicing the date Message-ID: <9173@dasys1.UUCP> Date: 1 Apr 89 03:21:16 GMT References: <216000010@s.cs.uiuc.edu> Reply-To: jpr@dasys1.UUCP (Jean-Pierre Radley) Organization: TANGENT Lines: 23 In article <216000010@s.cs.uiuc.edu> carroll@s.cs.uiuc.edu writes: >Allright, I can't figure this out. I'm trying to put the current system >time in my prompt. Under SysV, I can use 'cut' to pick out the seperate >hours, minutes, and seconds from 'date'. For non-SysV types, 'cut' lets >you pick out fields using either delimiter characters or absolute column >counts. I found a way to do this using Ksh (with the pattern matchers), >but it is very ugly. The question is, how can I cut up the output of >date to put the hours, minutes, and seconds into seperate variables? Thanks! Using 'cut'? Why? Why not just pick a format from the repertoire of the 'date' command, then use the /bin/sh built-in "set" to extract variables? set `date "+%H %M %S"` ; echo $1 $2 $3 Or maybe you want TIME = `date "+%H:%M:%S"` -- Jean-Pierre Radley Honi soit jpr@dasys1.UUCP New York, New York qui mal ...!hombre!jpradley!jpr CIS: 76120,1341 y pense ...!hombre!trigere!jpr