Skip to content

Instantly share code, notes, and snippets.

@bfulton
Forked from tlunter/test.sh
Created November 2, 2014 20:00
Show Gist options
  • Save bfulton/53d9b80cad67c7e1e2f1 to your computer and use it in GitHub Desktop.
Save bfulton/53d9b80cad67c7e1e2f1 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e -o pipefail
set +e
{ echo "test"; echo "test2"; } | cat > /dev/null
echo $?
set -e
set +e
{ echo "test"; echo "test2"; } > /dev/null
echo $?
set -e
set +e
{ echo "test"; false && echo "test2"; } | cat > /dev/null
echo $?
set -e
set +e
{ echo "test"; false && echo "test2"; } > /dev/null
echo $?
set -e
# $ ./test.sh
# 0
# 0
# 1
# 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment