I must say, having increasingly elaborate forms of variable substitution to do things like this seems like poor design. I would favor constructions like
$ BAZ=$( <<<$FOO some_program args ) Although I must say, I can't recall off the top of my head what Un*x utility best capitalizes the first letter of a string. Dale