title: First character of a variable in a shell script to uppercase?
body: <p>I have a shell script that starts unit tests for modules. I need the name of the module in all lowercase and with the first character uppercase. So far I have been doing it like this:</p>
  
  <pre><code>#!/bin/sh -x                                                                                                                                                                          
  # z.B. getbrowser                                                                                                                                                                     
  strModuleToTest=$1
  
  # g                                                                                                                                                                                   
  strModuleToTestUppercaseFirstletter=${strModuleToTest:0:1}
  # etbrowser                                                                                                                                                                           
  strModuleToTestUppercaseLastletters=${strModuleToTest:1}
  
  # g -&gt; G                                                                                                                                                                              
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/a/A}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/b/B}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/c/C}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/d/D}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/e/E}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/f/F}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/g/G}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/h/H}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/i/I}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/j/J}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/k/K}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/l/L}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/m/M}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/n/N}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/o/O}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/p/P}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/q/Q}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/r/R}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/s/S}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/t/T}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/u/U}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/v/V}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/w/W}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/x/X}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/y/Y}"
  strModuleToTestUppercaseFirstletter="${strModuleToTestUppercaseFirstletter/z/Z}"
  
  # Getbrowser
  strModuleToTestUppercase=$strModuleToTestUppercaseFirstletter""$strModuleToTestUppercaseLastletters
  </code></pre>
  
  <p>What would be an easier way to set $strModuleToTestUppercase? I tried </p>
  
  <pre><code>strModuleToTestUppercase="${strModuleToTest[@]^}"
  </code></pre>
  
  <p>or</p>
  
  <pre><code>strModuleToTestUppercasesed="sed 's/\&lt;./\u&amp;/g' $strModuleToTest"
  </code></pre>
  
  <p>but without success.</p>