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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write the syntax for "if" conditionals in linux?

599


Write a script to print the first 10 elements of fibonacci series.

1772


write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?

3591


How to calculate the number of passed arguments?

558


How do I run a script on mac?

572






Please give me example of " at command , contrab command " how to use

2331


Why is the use of shell script?

545


I want to create a directory such that anyone in the group can create a file and access any person's file in it but none should be able to delete a file other than the one created by himself.

599


How do I read a .sh file?

532


How will you print the login names of all users on a system?

577


How do I run a script from command prompt?

562


What is the difference between grep and egrep?

614


What is $1 in shell scripting?

593


What is mac default shell?

617


How do you debug a script?

569