Skip to content

Instantly share code, notes, and snippets.

@adoyle-h adoyle-h/t.bash Secret
Created Jul 2, 2019

Embed
What would you like to do?
another return
#!/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
You can’t perform that action at this time.