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

[Click Here to get other programs by email ]

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

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


3.a) Shell function that takes a valid directory names as an argument an recursively descends all the sub directories, finds the maximum length of any file in that hierarchy and writes this maximum value to the standard output.

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

clear

find

{

clear tput

echo -e “Enter a valid directory name : ”

read dir

if [  -d @dir ]

then

ls -1R $dir>file1

grep -h “^-r” file1>file2

cat file2

cut -c 24-28 file2>file3

sort -n file3>file4

tail -1 file4>file5

echo -e “Max length is ”

cat file5

else

else

echo -e “Invalid dir ”

fi

}

[Click Here to get other programs by email ]

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