Skip to main content
edited tags
Link
Kusalananda
  • 356.1k
  • 42
  • 737
  • 1.1k
Source Link

Return value inside unbuffer command

I have the following bash code to capture the result of a build while printing the output to the screen and provide parsing of the build results.

output=$(unbuffer cmake ... | tee /dev/tty) parseErrors ${output} 

parseErrors does what it sounds like. It parses the output for anything that looks like an error. I can exit there, but would rather do it after the function call. How do I get the return status from the cmake build passed to the unbuffer command? I have tried using PIPESTATUS[0], but I think that is returning the value from unbuffer itself.