0% found this document useful (0 votes)
9 views

Osy PR 13

Uploaded by

Disha Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Osy PR 13

Uploaded by

Disha Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Name: Disha Agrawal

Roll no: 05

Practical no: 13

Q1)Write a shell script to find out whether - File has read, write and execute permissions.
echo ―Enter the File : ‖
read line if [ -r $line ]
then echo ―$line has all the read
permissions‖
fi
if [ -x $line ]
then echo ―$line has all the execute
permissions‖ fi if [ -w $line ] then
echo ―$line has all the write
permissions‖ fi

Output:

Q2) Write a shell script which displays the list of all executable files in the current working
directory.
pwd
ls > f
exec < f
while read
line do if [
-f $line ]
then
if [ -x $line ]
then echo
―$line‖
fi fi
done

Output:

Q3) Write a shell script which displays a list of all the files in the current directory to
which user has read, write and execute permission.

. pwd
ls > f
exec < f
while read
line do if [
-f $line ]
then if [ -r $line –a –w $line –a –x
$line ] then echo ―$line has all the
permissions‖ fi fi
done

Output:

Q3)Write a shell script which accepts a filename and assign it all the permissions.
Echo ―ENTER THE FILE : ‖
Read file
Chmod u+xrw $file
Chmod o+xrw $file
Chmod g+xrw $file

Output:

You might also like