I want to uppercase just the first character in my string with bash.
foo=\"bar\"; //uppercase first character echo $foo;
should print \"B
To capitalize first word only:
foo='one two three' foo="${foo^}" echo $foo
One two three
To capitalize every word in the variable:
foo="one two three" foo=( $foo ) # without quotes foo="${foo[@]^}" echo $foo
One Two Three
(works in bash 4+)