For this question I will use grep, because its usage text prints to stderr:

$ grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.

You can capture stdout easily with process substitution:

$ read b < <(echo hello world)

However stderr slips past the process substitution and prints to the console:

$ read b < <(grep)
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.

I would like to capture stderr using process substitution. I am using this now:

$ grep 2> log.txt

$ read b < log.txt

but I am hoping to avoid the temp file.

Edit
Report