On Tuesday, August 18, 2015 08:50:51 AM Dan Douglas wrote:
> I'm pretty sure that's intentional. The corresponding `declare -c` has never
> been documented either.
>
Hrm, it doesn't "correspond" actually. declare -c just capitalizes the first
letter of the string.
Another thing about the ${var~} expansions is I wonder why it isn't just built
in to the substitution expansion. The `~` is obviously inspired by the vim
movement to toggle caps. Given `foobarbaz`, vim can also do `:s/foo\zs\(bar\)
\zebaz/\U\1/` and yield `fooBARbaz`. This is much more powerful, though it
requires bash to start supporting backrefs in substitutions.
There's also this ksh feature I've never found a use for:
$ ksh -c 'x=foobarbaz; typeset -M toupper x; echo "$x"'
FOOBARBAZ
I don't know, the only purpose is to replace `typeset -l/-u` and allow for
other towctrans operations.
--
Dan Douglas