use more portable form of defining bash / zsh functions