This post was published long ago, when I was a student and an amateur blogger. The links might be broken and content may not be useful anymore. Please read this content keeping its age in mind.

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

………………………………………………………………………………………………………………………….
PART -B

………………………………………………………………………………………………………………………….

1. a) Non-recursive shell script that accepts any number of arguments and prints them in the Reverse order, ( for example, if the script is named rags, then executing rags A B C should produce C B A on the standard output).

……………………………………………………………………………………………………………………………

if [ $# -eq 0]

then

echo -e “No arguments”

else

a=($*)

echo -3 “Arguments are”

echo $*

let x=$#

echo -2 “Arguments in reverse order ”

while [ $x -ne -1]

do

echo -e “${a[$x]}”

let x=x-1

done

fi

[Request : If you are going to post this program on any other website please link back to original post ]