- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are Alternative Ways to Reverse a String from Shell?
In the Linux shell, we have predefined commands to return a reversed string. Anyone can use these commands for reversing an output of the program.
Perl Command
It is a general-purpose programming language in Linux.
Input
perl -ne 'chomp;print scalar reverse . "
";'<<<”Hello"
Output
olleH
Rev Command
It is an inbuilt program to reverse the line of character.
Input
rev<<<"Hello yam" OR echo “Hello yam” | rev
Output
olleH may
Conclusion
In this article, we discuss the basic understanding of shell scripting. It also addressed reversing a string using shell programming and some alternative inbuilt commands of Linux. Creating shell scripts becomes easy if you know how to work on shell and control the flow of shell programs. I hope you find this article helpful.
Advertisements