Enter your email address & Win:

System Software Lab Programs ( UNIX Programs ) – 3a

// March 8th, 2009 // Engineering, Unix and System Software Lab // Written by

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 ]


If you enjoyed this post, make sure you subscribe to my RSS feed!

Get Adobe Flash playerPlugin by wpburn.com wordpress themes