Some common functions in bash/ksh format