Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pjjw
Created July 31, 2018 20:22
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 pjjw/83a8aa5625dabca0df8f271b31064fac to your computer and use it in GitHub Desktop.
Save pjjw/83a8aa5625dabca0df8f271b31064fac to your computer and use it in GitHub Desktop.
bash is cool
#!/bin/bash
set -euo pipefail
set -x
if [ ! -z "$(echo foo)"]; then
echo "we should never get here"
exit 1
fi
echo "we should never get here either"
$ bash bad.sh
++ echo foo
+ '[' '!' -z 'foo]'
bad.sh: line 5: [: missing `]'
+ echo 'we should never get here either'
we should never get here either
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment