Вопрос

I want to emulate rev command (on alphabet) with the tr command

So I did this

echo abcdefghijklmnopqrstuvxyz | tr '[z-a]' '[a-z]'

That gives me

tr: range-endpoints of `z-a' are in reverse collating sequence order

So I tried

echo abcdefghijklmnopqrstuvxyz | tr 'abcdefghijklmnopqrstuvxyz' 'zyxvutsrqponmlkjihgfedcba'

and it works ok, output is zyxvutsrqponmlkjihgfedcba

That is wrong with tr '[z-a]' '[a-z]'?

If I specify tr '[a-c]' '[c-a]' it also works fine.

Any help would be appreciated

Thank you

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top