I know the basic way of reading from a command in bash:
cal | while IFS= read -r line ; do
echo X${line}X
done
But what if I want to read one line from several files/commands in a loop? I've tried named pipes but they'd only spit out one line.
$ cal > myfifo &
$ IFS= read -r line < myfifo
[cal exits]
$ echo $line
February 2015
So what I'd really want is something like:
while [all pipes are not done]; do
IFS=
read line1 < pipe1 # reading one line from this one
read line2 < pipe2 # and one line from this one
read line3 < pipe3 # and one line from this one
print things with $line1 $line2 and $line3
done
Big picture what I'm trying to do is process three different months from cal to do some colorizing for use with Conky. It's a bit of yak shaving, honestly, so has become academic and a 'learning experience' at this point.