merge functions.sh to generate.sh, for portability
remove functions.sh