Blogger news

Followers

Tuesday, August 12, 2014
#A non-recursive shell script that accepts any number of arguments and prints #them in the Recursive order, (For example,if the script is named rargs,then #executing rags ABC should produce CBA on the standard output)

echo "input string is :$*"
for x in "$@"
do
y=$x" "$y
done
echo "reversed string is: $y"

---------
output:

sh <filename>.sh x y z
input sting is :x y z
reversed string is: z y x 

1 comments:

Anonymous said...

./reverse.sh a b c
output will be
c
b
a