hi @rich
wrt title : in a script, could I have the main body folowed by its functions at the botom?
you can order functions in the script however you like
the order the of the named blocks in the script should not affect the script execution
unless a function is called before its defined
which will result in error
$script: line $X: $funcname: not found
as mentioned :
https://forum.tinycorelinux.net/index.php/topic,26125.msg167737.html#msg167737the example
adding an optional explicit case to call the main function then exit
and two return cases , one for no arguments and , one for all other args
allows changing script execution path making calling the main function optional
so other functions can be sourced into shell or other scripts
perhaps its considered better to have ?? ( that seams to be the gist of your reply )
lib-foo.sh
and
foo.sh
where foo.sh effectively encapsulates main block
and lib-foo.sh holds the functions to import