Skip to content

Instantly share code, notes, and snippets.

@garethrees
Last active November 28, 2018 10:06
Show Gist options
  • Save garethrees/0145acd3efd0541fba7486a505802bcd to your computer and use it in GitHub Desktop.
Save garethrees/0145acd3efd0541fba7486a505802bcd to your computer and use it in GitHub Desktop.
tee stderr and log both output streams
# stderr as process output, and then stdout and stderr to independent log files
command 1> stdout.log 2> >(tee -a stderr.log >&2)
# stdout as process output, and then stdout and stderr to independent log files
command 2> stderr.log 1> >(tee -a stdout.log >&1)
#!/usr/bin/env ruby
STDOUT.puts 'hi from stdout'
STDERR.puts 'hi from stderr'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment