Skip to content

Instantly share code, notes, and snippets.

@thomasjo
Created April 15, 2014 20:14
Show Gist options
  • Save thomasjo/10768169 to your computer and use it in GitHub Desktop.
Save thomasjo/10768169 to your computer and use it in GitHub Desktop.
Simple repro of bash command substitution not short-circuiting as expected.
#!/usr/bin/env bash
test1() {
local output
output="$(/does/not/exist)"
echo "${output}"
}
test2() {
local output
output="$(/does/not/exist)"
}
test1
echo $? # prints 0
test2
echo $? # prints 127
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment