I have a Bash function, foo(), which will return 0 or 1 always. When it is returning 0, it would have produced some stdout:
foo() { if ... echo "aaa\nbbb" return 0 else return 1 fi } I want to repeatedly call this foo function, process its stdout, until it returns non-zero:
while foo; do # process foo's stdout that that one execution done But I don't know how to cleanly store the stdout of foo and use it in the while expression at the same time.
In ruby I might have done something like:
while text = self.foo do ... end Any suggestions? TIA