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

Explore about environment variables?

1 Answers  


How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?"

12 Answers   Cap Gemini,


What is the use of "test" command?

2 Answers  


What are the disadvantages of shell scripting?

1 Answers  


What is inside a seashell?

1 Answers  


Is it possible to substitute "ls" command in the place of "echo" command?

1 Answers  


In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

1 Answers  


How do you rename the files(*.sh) with file names containing space in it?for example "interview question.sh" needs to rename to "interview-question.sh". Appreciate your inputs.Thanks.

5 Answers   Wells Fargo,


how to get part of string variable with echo command only?

1 Answers  


c program to check whether all the directories in the path exists has read and write permission

1 Answers  


How does ls command work?

1 Answers  


How do I set bash as default shell mac?

1 Answers  


Categories