ucfirst()

# ucfirst() -- Make a string's first character uppercase
# Usage: ucfirst string
# depend: strtoupper(): http://www.ronggeng.net/index.php/2009/04/24/strtoupper/
#
# Example:
#
# ucfirst "test test test";
#

if [ -n "${BASH_VERSINFO[0]}" ] && [ ${BASH_VERSINFO[0]} -gt 3 ]; then
	# Updated: 20-Aug-2009 - for bash version 4
	ucfirst() {
		[ $# -eq 1 ] || return 1;
		echo ${1^};
		return 0;
	}
else
	ucfirst() {
		[ $# -eq 1 ] || return 1;
		! type -t strtoupper &>/dev/null && return 1;
		echo "$(strtoupper "${1:0:1}")${1:1:${#1}}";
		return 0;
	}
fi