On 2024-05-17 08:40, Mark J. Reed wrote:
Functions are great, and I recommend using them - just use them _inside_ the script. For anything but the most trivial scripts I make the main body of the script a function, too, something like this:

#!/usr/bin/env zsh
main() {
    main program code here
}

Hmmm.  So we can have it both ways -- the flow control of functions but it all vanishes when the script exits?  I'll experiment with that.

...

Only define functions inside your interactive shell when they need to make changes that persist after they exit - like changing directories, or updating variable values, etc.
That would limit their number considerably.  Ok, goodbye functions ... I mean ... how do you say it?  ... functions at the 'zero level' ... not within a script.  Hearing the same thing from yourself and Roman seals the deal.