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

Given a file find the count of lines containing the word "abc".

0 Answers  


What are types of shells?

0 Answers  


What language is shell scripting?

0 Answers  


What does chmod do?

0 Answers  


What is the best scripting language?

0 Answers  






Can you write a script to portray how set –x works?

0 Answers  


How does shell scripting work?

0 Answers  


What is sed in shell script?

0 Answers  


What does echo mean in scripting?

0 Answers  


Is shell scripting difficult?

0 Answers  


What are the Different types of shells?

5 Answers  


Why do we write bin bash in shell scripts?

0 Answers  


Categories