3 ms·
I really hate writing things in reverse, but a decent style in Bash is to put everything in functions, w/ a main() at the top: #! /usr/bin/env bash set
by xrt 12y ago
I really hate writing things in reverse, but a decent style in Bash is to put everything in functions, w/ a main() at the top:
#! /usr/bin/env bash
set -e -u
bar='bar'
main() {
foofunction
}
foofunction() {
echo 'foo'
echo $bar
}
main "$@"