write a non recursive shell script that accepts any number
of arguments and prints them in the reverse order

Answers were Sorted based on User's Feedback



write a non recursive shell script that accepts any number of arguments and prints them in the rev..

Answer / naresh babu

echo "no of arguments:$#"
echo "arguments in reverse order:"
for i in $*
do
j=$i" "$j
done
echo $j

Is This Answer Correct ?    26 Yes 9 No

write a non recursive shell script that accepts any number of arguments and prints them in the rev..

Answer / drths

$ sh rev.sh 123 ---Script name with 1 cmd line argument
------------------------------
#! /bin/sh
abc=$1 ###123 will store in abc
pqr=`echo $pqr | rev` ### 123|rev
echo $abc
-----------------------------
o/p : 321

Is This Answer Correct ?    0 Yes 5 No

write a non recursive shell script that accepts any number of arguments and prints them in the rev..

Answer / amar

./reverse frg gh rtyh
no of arguments:3
arguments in reverse order:
rtyh gh frg

Is This Answer Correct ?    0 Yes 8 No

Post New Answer

More Shell Script Interview Questions

madhar chod unix ke 10 commands dhang se likh nahi sakta hai

0 Answers   Cap Gemini,


Is shell script a programming language?

0 Answers  


wats the she bang statment with syntax?

3 Answers  


I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?

0 Answers  


How to print all array elements and their respective indexes?

0 Answers  






what is "umask"?

6 Answers   Wipro,


How important is shell scripting?

0 Answers  


Explain about "s" permission bit in a file?

0 Answers  


What does the sh command do?

0 Answers  


Calculate a real number calculation directly from the terminal and not any shell script.

0 Answers  


What is k shell?

0 Answers  


How to take input values from the user?

4 Answers  


Categories