Skip to content

Instantly share code, notes, and snippets.

@dgdavid
Last active September 18, 2018 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgdavid/1873f777ab780a6d5f4a6a9acb9343cf to your computer and use it in GitHub Desktop.
Save dgdavid/1873f777ab780a6d5f4a6a9acb9343cf to your computer and use it in GitHub Desktop.
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