Skip to content

Instantly share code, notes, and snippets.

@mkmik
Created March 10, 2020 08:56
Show Gist options
  • Save mkmik/fe3819bf93ad9ddf86ade560f6e611a6 to your computer and use it in GitHub Desktop.
Save mkmik/fe3819bf93ad9ddf86ade560f6e611a6 to your computer and use it in GitHub Desktop.
#!/bin/bash
fake_command() {
echo some junk
return 1
}
demo() {
FOO="$(fake_command)"
if [ -z "$FOO" ]; then
echo output is empty
return 1
fi
echo output is $FOO
}
echo "Testing without -e"
demo
echo "Testing with -e"
set -e
demo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment