temlate.sh - add function log and do_cmd.