سؤال

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