I know there are caveats about using read in pipelines because read is treated by a subshell. I know this but I can't think of any way to accomplish this regardless, I'm still a rookie.
I hope somebody will be able to interpret what it is that I'm trying to accomplish and correct me.
gist, trying to use output from command:
$ date -u '+%d %h %y' <enter>
05 Jan 09
##want to store 05 Jan 09 to variables DAY MONTH YEAR respectively; also want Jan to be all caps, so tr is used in pipeline##
$ date -u '+%d %h %y' | tr '[:lower:]' '[:upper:]' <enter>
05 JAN 09
##okay, so I got desired format for output, now I want those values stored, so just add a read command statement with the day month year as operands, right??##
$ date -u '+%d %h %y' | tr '[:lower:]' '[:upper:]' | read DAY MONTH YEAR <enter>
$ echo $DAY
$
##var DAY carries empty value--what am I doing wrong or what would be the correct way to achieve desired result of storing 05 JAN 09 output of date/tr commands to those variables??##
thanks in advance