Osy PR 13
Osy PR 13
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: