I am new to bash scripting. I can do this:
while [ read line ]
do
# do something with $lin
done
I can also do this:
while [ checkBufferedLines ]
do
# do something
done
But what I'm wanting to accomplish is something like this:
while [ read line ] || [ checkBufferedLines ]
do
# do something with $line or the buffered lines
done
Concisely, I want the loop to run if a $line
is assigned from stdin
or if a function call returns true
or 1
, and I would like a $line
to short-circuit the function call if present.
That's what I'm trying to accomplish; can this be done? Or will read line
stop the loop so the checkBufferedLines
function isn't also evaluated on the 'or' condition?