Since you're using bash, if you stored your string in a variable you could also do it shell-only:
uscore="this_is_the_string_to_be_converted"
arr=(${uscore//_/ })
printf %s "${arr[@]^}"
ThisIsTheStringToBeConverted
${uscore//_/ } replaces all _ with space, (....) splits the string into an array, ${arr[@]^} converts the first letter of each element to upper case and then printf %s .. prints all elements one after another.
You can store the camel-cased string into another variable:
printf -v ccase %s "${arr[@]^}"
and use/reuse it later, e.g.:
printf %s\\n $ccase
ThisIsTheStringToBeConverted
Or, with zsh:
uscore="this_is_the_string_to_be_converted"
arr=(${(s:_:)uscore})
printf %s "${(C)arr}"
ThisIsTheStringToBeConverted
(${(s:_:)uscore}) splits the string on _ into an array, (C) capitalizes the first letter of each element and printf %s ... prints all elements one after another..
To store it in another variable you could use (j::) to joins the elements:
ccase=${(j::)${(C)arr}}
and use/reuse it later:
printf %s\\n $ccase
ThisIsTheStringToBeConverted