Skip to content

Instantly share code, notes, and snippets.

@irozgar
Last active January 29, 2020 15:21
Show Gist options
  • Save irozgar/bf82e33c4ece0f77e0266e5c6b45f0d8 to your computer and use it in GitHub Desktop.
Save irozgar/bf82e33c4ece0f77e0266e5c6b45f0d8 to your computer and use it in GitHub Desktop.
notes about bash
#!/usr/bin/env bash
# set -exo pipefail
set -ex
echo running false
# grep fails, but since it's piped and pipefail is not enabled the result of the full
# command exists with zero (sort is the last command executed) if we enable pipefail
# this will fail, so teh script will exit with error code 1 because of -e
grep test nonexistentfile | sort
echo running true
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment