Move shared bash functions into a separate file to be sourced, to avoid repetition / changes being out of sync.