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"

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is web script?

588


Print the 10th line without using tail and head command.

1686


What is shell application?

577


Explain about debugging?

614


What is path in shell script?

643






How to get the last line from a file using just the terminal?

676


What are the different commands available to check the disk usage?

499


What happens when you type ls?

577


Can we run shell script in windows?

590


Is bash a shell script?

611


How do I debug a shell script?

573


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

704


How do I run a script on mac?

574


Can shell script run on windows?

576


How to set an array in linux?

600