Skip to content

Instantly share code, notes, and snippets.

@thewoolleyman
Created March 8, 2018 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thewoolleyman/a42b0b809df8b4d4027faba69188b554 to your computer and use it in GitHub Desktop.
Save thewoolleyman/a42b0b809df8b4d4027faba69188b554 to your computer and use it in GitHub Desktop.
STDOUT and STDERR examples

helpful one-liner examples for testing STDOUT and STDERR:

Print only stdout: ruby -e 'i=$stderr.puts("err"); $stderr.flush; $stdout.puts("out"); $stdout.flush; exit' 2>/dev/null

Print only stderr: ruby -e 'i=$stderr.puts("err"); $stderr.flush; $stdout.puts("out"); $stdout.flush; exit' 1>/dev/null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment