fork(3) download
  1. to_pascal_with_underscores() {
  2. local s=${1^} re='(.*[[:lower:]]_+)([[:lower:]].*)'
  3. while [[ $s =~ $re ]]; do
  4. s=${BASH_REMATCH[1]}${BASH_REMATCH[2]^}
  5. done
  6. echo "$s"
  7. }
  8.  
  9. to_pascal_with_underscores this_is_a_test
  10. to_pascal_with_underscores to_camel_case__variable
Success #stdin #stdout 0s 19688KB
stdin
Standard input is empty
stdout
This_Is_A_Test
To_Camel_Case__Variable