I need to ensure a command is outputting the correct text. I currently have:
command_stdout="$(mycommand --flag 2>/dev/null)"
command_stderr="$(mycommand --flag 2>&1 1>/dev/null)"
Instead of having to run the same command twice, is there any way I can run it once but still be able to save stdout and stderr's output to their appropriate variables?
Redirect stderr to a file, then set the second variable to the file contents.