I'm looking for an opposite of this: Trick an application into thinking its stdin is interactive, not a pipe
I'd like to get the output of a command on stdout, but make it think it's writing into a pipe.
The usual solution is to | cat
but I have the additional requirement that this is cross platform (ie sh
, not bash
) and returns a valid exit code if the command fails. Normally I would use pipefail but this isn't available everywhere.
I've tried various incantations of stty
but haven't been successful.