Skip to content

Instantly share code, notes, and snippets.

@mattieb
Last active November 21, 2021 10:34
Show Gist options
  • Save mattieb/344361751c0110419b0f to your computer and use it in GitHub Desktop.
Save mattieb/344361751c0110419b0f to your computer and use it in GitHub Desktop.
makes output on both stdout and stderr
#!/bin/sh
#
# This script outputs "stdout" to stdout and "stderr" to stderr.
#
# Try it like this and observe the differences:
#
# out-vs-err.sh 2>&1 >/dev/null
# out-vs-err.sh >/dev/null 2>&1
#
# See <http://stackoverflow.com/questions/10508843/what-is-dev-null-21/10508862#comment48709328_10508843>
#
echo stdout >&1
echo stderr >&2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment