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

Is bash an operating system?

1 Answers  


is there any command to find user password?

4 Answers  


What is a shell environment?

1 Answers  


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

5 Answers   Wipro,


Hi, I want to practise Unix korn shell scripting which i learnt 2 yr bfr. plz suggest software i can use to practise.

1 Answers  


What are the types of script?

1 Answers  


What is bash command used for?

1 Answers  


How do I run a bin bash script?

1 Answers  


Write a command sequence to find all the files modified in less than 2 days and print the record count of each.

1 Answers  


What can scripts do?

1 Answers  


What is shift command in shell script?

1 Answers  


How do I run a script on mac?

1 Answers  


Categories