Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!eecae!netnews.upenn.edu!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.unix.questions Subject: Re: slicing the date Message-ID: <9950@smoke.BRL.MIL> Date: 30 Mar 89 02:57:10 GMT References: <216000010@s.cs.uiuc.edu> <431@ncsc1.AT&T.NCSC> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 7 In article <431@ncsc1.AT&T.NCSC> dgp@ncsc1.AT&T.NCSC (Dennis Pelton CSM Contractor x8876) writes: >Why is it that the following does NOT work? > date +'%H %M %S' | read hrs min sec Because the shell built-in "read" runs in a subshell due to the pipeline. You're setting the variables in a subshell, all right, but that isn't what you wanted.