Enter your email address & Win:

System Software Lab Programs ( UNIX Programs ) – 2a

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

Subject : System Software Laboratory

Branch : Information Science & Engineering

Semester : 6

University : VTU

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

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

2a.  Shell script that accepts two file names as arguments, checksif the permissions for these files are identical and if the permissions are identical, outputs the common permissions,  otherwise outputs each file name followed by its permissions.

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

#include<sys/types.h>

#include<sys/stat.h>

#include<unistd.h>

clear

if [ $# -ne 2]

then

echo -e “\n Two arguments are not passed \n”

else

{

ls -l $1>file1

ls -l $2>file2

cut -c 1-10 file1>file3

cut -c 1-10 file2>file4

cmp file3 file4>res

if test -s res

then

echo -e “\n Files are having different permission\n”

cat file1

cat file2

else

{

echo -e “\n Both files have same attributes\n”

cat file1

cat file2

}

fi

}

fi

[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