-
-
Save adoyle-h/c52d778b9b01c183d0eb41aa16892177 to your computer and use it in GitHub Desktop.
another return
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
shopt -s inherit_errexit | |
readonly true=1 | |
readonly false=0 | |
return() { | |
case $1 in | |
0|true) | |
echo true ; | |
builtin return 0 | |
;; | |
1|false) | |
echo false ; | |
builtin return 1 | |
;; | |
*) | |
echo $1 ; | |
builtin return $1 ;; | |
esac | |
} | |
is_success() { | |
return false | |
} | |
foo() { | |
local a | |
a=$(is_success) | |
echo "$a" | |
} | |
foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment