3

With the zsh shell:
set -o extendedglob
lc_var=${var/%(#m) */${(L)MATCH}}
Where ${var/%pattern/replacement} like in ksh replaces the end of the var that matches the pattern with the replacement, (#m) causes the matched portion to be stored in $MATCH (that's the part that needs extendedglob) an...