#! /usr/bin/env bash set -e -u bar='bar' main() { foofunction } foofunction() { echo 'foo' echo $bar } main "$@"