It’s easy just use the tr command to lower, upper or capital case.

Here is an example…

1
2
3
4
5
6
7
8
9
function toCapital
{
   for x in $*
   do
      echo -n ${x:0:1} | tr '[a-z]' '[A-Z]' | xargs echo -n
      echo -n ${x:1} | tr '[A-Z]' '[a-z]' | xargs echo -n
      echo -n " "
   done
}

To test the function just call it:

1
toCapital yuCa aMigo

The output is:

Yuca Amigo

Hope it’s useful.