Toggling string case in linux bash

It’s quite an academic task, but anyway useful sometimes. I’ve collected different ways to do it in terminal in linux. Some of them work with UTF-8 characters (some it will toggle case for “й”, “ё” and so on. It will not in general handle special ligatures, such as “ß”” and “fi”.)

Ways are: sed, perl, python, awk, tr, bash, dd.