Functions and templates for bash scripting