Create a bash shell script that reads a line from the user
consisting of 5 words and then prints them out in reverse
order. Name this script "reverse.sh"



Create a bash shell script that reads a line from the user consisting of 5 words and then prints th..

Answer / priyanka joshi

read line;
echo $line | awk '{ for ( i = NF; i > 0; i--) print $i}' |
tr "\n" " "

Is This Answer Correct ?    5 Yes 5 No

Post New Answer

More Shell Script Interview Questions

Write a shell script in Linux to shift all characters in a file forward by five characters. (Thus “a” becomes “f’”).

2 Answers   Ignou, Tripura Info,


What is Linux language details

0 Answers   Quick Heal,


How do I read a .sh file?

0 Answers  


how is the oppurtunities for unix in the software

1 Answers  


write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?

0 Answers   Wells Fargo,


How to check if the previous command was run successfully?

0 Answers  


What does $1 mean in bash?

0 Answers  


What is shell and shell script?

0 Answers  


write a shell script to identify the given string is palindrome or not?

17 Answers   CTS, HP, IBM, InfoEst, Wipro,


The information of the two files should be redirect to Third file in such a way that, the third file contain the information like this. 1st line in third file should be from 1st file 2nd line in Third file should be from 2nd file 3rd line in Third file should be from 1st file 4th line in Third file should be from 2nd file - - so on

2 Answers   Caritor,


How to print all array elements and their respective indexes?

0 Answers  


write a program to display all the files from the current directory which are created in particular month

6 Answers  


Categories