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

How do I open a jshell in cmd?

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  


What is the syntax of "grep" command?

4 Answers  


What is the difference between bash and shell?

0 Answers  


I want to read all input to the command from file1 direct all output to file2 and error to file 3, how can I achieve this?

1 Answers  






What are different types of shell?

0 Answers  


How do you schedule a command to run at 4:00 every morning?

5 Answers   Wipro,


How do you print the output the same string which is typed in command line. how do you write the shell script or command for this. if i entered "Hello" in command line, it should print 'Hello', if i say "Hello Welcome", i should get the "Hello Welcome" as output.?

3 Answers   IBM, Symphony,


Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.

0 Answers  


How do I run a shell script on a mac?

0 Answers  


What is sed in shell script?

0 Answers  


What is bash shell command?

0 Answers  


Categories