Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!pyramid!prls!philabs!linus!raybed2!rayssd!mirror!frog!john From: john@frog.UUCP (John Woods) Newsgroups: comp.unix.questions Subject: Re: another way (was Re: slicing the date) Message-ID: <1200@frog.UUCP> Date: 3 Apr 89 23:43:00 GMT References: <216000010@s.cs.uiuc.edu> <1177@Portia.Stanford.EDU> <4259@omepd.UUCP> Organization: Misanthropes-R-Us Lines: 22 In article <4259@omepd.UUCP>, merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) writes: E> In article <1177@Portia.Stanford.EDU>, karish@forel (Chuck Karish) writes: l> | set `date | tr ':' ' '` e> | hr=$4 g> | min=$5 a> | sec=$6 n> | If that's not ugly enough for you, use this instead: c> | expr "`date`" \: ".*\([ 0-9][0-9]:..\):.*" e> For the truly ugly (and no additional processes), try: .> oldIFS="$IFS" IFS=": "; set - `date`; hr=$4 min=$5 sec=$6 IFS="$oldIFS" For the truly elegant (with no additional processes), scarf up the date.c I just posted to comp.unix.questions and alt.sources (if you don't have a System V date command), and try eval `date '+hr=%H min=%M sec=%S'` -- John Woods, Charles River Data Systems, Framingham MA, (508) 626-1101 ...!decvax!frog!john, john@frog.UUCP, ...!mit-eddie!jfw, jfw@eddie.mit.edu Remainder Khomeini!