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

What does $@ mean bash?

0 Answers  


Why are there shells on the beach?

0 Answers  


Why do we use shell scripting?

0 Answers  


What is the difference between a shell variable that is exported and the one that is not exported?

6 Answers  


What is the way to do multilevel if-else's in shell scripting?

0 Answers  






What is bourne shell scripting?

0 Answers  


I want to connect to a remote server and execute some commands, how can I achieve this?

0 Answers  


What is basename in shell script?

0 Answers  


I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?

0 Answers  


how to read systems current date and time

4 Answers  


How to get the 3rd element/column from each line from a file?

0 Answers  


How do I run a shell script on a mac?

0 Answers  


Categories