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 will you list only the empty lines in a file (using grep)?

4 Answers   ANZ,


What lives in a shell?

0 Answers  


In shell scripting if text is surrounded by single quotes what does it denotes?

3 Answers  


how will you find the total disk space used by a specific user?

0 Answers  


write a shell script to emulate the Id command of PRIMOS which lists files and directories. It list files first with a header FILES and then directories with a header DIRECTORIES. This command has several options. The main ones are. -file select files only -dir select directories only -reverse sort in reverse order -no_header put no header on the output -brief output the header only -size display the size of each file -help display Id´s syntax and options.

0 Answers  






Where cron file kept?

2 Answers   Tech Mahindra,


Hi All, Is it possible to create one file name only space or space in file name in UNIX and we can able to run that on Unix?

2 Answers   Cap Gemini,


What is a shell script? Can you name some of its advantages?

0 Answers  


What is awk in shell script?

0 Answers  


How many prompts are available in a UNIX system?

1 Answers  


What is basename in shell script?

0 Answers  


Explain about shebang?

0 Answers  


Categories