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
………………………………………………………………………………………………………………………….
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 permissionn”
cat file1
cat file2
else
{
echo -e “n Both files have same attributesn”
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 ]
Leave a ReplyCancel reply