reverse the order of characters in a string

I know you said “without third-party tools”, but sometimes a tool is just too obviously the right one, plus it’s installed on most Linux systems by default:

[madhatta@risby tmp]$ echo 12345 | rev
54321

See rev‘s man page for more.

Leave a Comment