Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!husc6!ogccse!littlei!omepd!merlyn From: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Newsgroups: comp.unix.questions Subject: another way (was Re: slicing the date) Message-ID: <4259@omepd.UUCP> Date: 30 Mar 89 19:41:44 GMT References: <216000010@s.cs.uiuc.edu> <1177@Portia.Stanford.EDU> Sender: news@omepd.UUCP Reply-To: merlyn@intelob.intel.com (Randal L. Schwartz @ Stonehenge) Organization: Stonehenge; netaccess via BiiN, Hillsboro, Oregon, USA Lines: 23 In-reply-to: karish@forel.stanford.edu (Chuck Karish) In article <1177@Portia.Stanford.EDU>, karish@forel (Chuck Karish) writes: | set `date | tr ':' ' '` | hr=$4 | min=$5 | sec=$6 | | If that's not ugly enough for you, use this instead: | | expr "`date`" \: ".*\([ 0-9][0-9]:..\):.*" For the truly ugly (and no additional processes), try: oldIFS="$IFS" IFS=": "; set - `date`; hr=$4 min=$5 sec=$6 IFS="$oldIFS" Amazing what /bin/sh can do for you if you let it. :-) (I'm trying to write EMACS in /bin/sh... anyone want to help? :-) Just another UNIX hacker, -- / Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 \ | on contract to BiiN (for now :-) Hillsboro, Oregon, USA. | |<@intel-iwarp.arpa:merlyn@intelob.intel.com> ...!uunet!tektronix!biin!merlyn | \ Cute quote: "Welcome to Oregon... home of the California Raisins!" /