slicing the date

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Mar 30 12:57:10 AEST 1989


In article <431 at ncsc1.AT&T.NCSC> dgp at 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.



More information about the Comp.unix.questions mailing list