Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Testing how to work with functions in a shell script
#!/usr/bin/env bash
function this_and_that_are_equals () {
this="me"
that="you"
if [ $this = $that ]; then
return 0
else
return 1
fi
}
echo "Working with functions"
echo "----------------------"
if this_and_that_are_equals; then
echo "-> this and that are the same thing"
else
echo "-> this and that are different"
fi
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.