Alternative solution (will work with old bash too)
DIR="SomeString" echo $(echo ${DIR:0:1} | tr "[AZ]" "[az]")${DIR:1}
prints
someString
to define a variable
DIR2="$(echo ${DIR:0:1} | tr "[AZ]" "[az]")${DIR:1}" echo $DIR2
prints
someString
alternate perl
DIR3=$(echo SomeString | perl -ple 's/(.)/\l$1/') DIR3=$(echo SomeString | perl -nle 'print lcfirst') DIR3=$(echo "$DIR" | perl -ple 's/.*/lcfirst/e'
some terrible decisions;
DIR4=$(echo "$DIR" | sed 's/^\(.\).*/\1/' | tr "[AZ]" "[az]")$(echo "$DIR" | sed 's/^.//') DIR5=$(echo "$DIR" | cut -c1 | tr '[[:upper:]]' '[[:lower:]]')$(echo "$DIR" | cut -c2-)
All of the above is verified using OSX /bin/bash .
jm666 source share