# lcfirst() -- Make a string's first character lowercase
# Usage: lcfirst string
# depend: strtolower(): http://www.ronggeng.net/index.php/2009/04/24/strtolower/
#
# Example:
#
# lcfirst "test test test";
#
if [ -n "${BASH_VERSINFO[0]}" ] && [ ${BASH_VERSINFO[0]} -gt 3 ]; then
# Updated: 20-Aug-2009 - for bash version 4
lcfirst() {
[ $# -eq 1 ] || return 1;
echo ${1,};
return 0;
}
else
lcfirst() {
[ $# -eq 1 ] || return 1;
! type -t strtolower &>/dev/null && return 1;
echo "$(strtolower "${1:0:1}")${1:1:${#1}}";
return 0;
}
fi