Recursion usually scares me a bit, but it worked out nicely here:
#convert "cx"-style Esperanto notation to native accents (ĉ)
function eaccent {
if [[ ${1:-} ]]; then
echo "$*" |eaccent
else
sed 's/cx/ĉ/g; s/gx/ĝ/g; s/hx/ĥ/g; s/jx/ĵ/g; s/sx/ŝ/g; s/ux/ŭ/g; s/C[xX]/Ĉ/g; s/G[xX]/Ĝ/g; s/H[Hx]/Ĥ/g; s/J[Xx]/Ĵ/g; s/S[Xx]/Ŝ/g; s/U[Xx]/Ŭ/g'
fi
}
#bash #unix #shell #scripts #scripting #UnixShell #ShellScripting #Esperanto
🍵 




