Professional Documents
Culture Documents
Thakare Practical no : 13
Roll no : 39
Program Code
1. Write a shell script to find out whether - File has read, write and
execute permissions.
Output
Name : Aditya B. Thakare Practical no : 13
Roll no : 39
Exercise
1. 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
2. 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
Name : Aditya B. Thakare Practical no : 13
Roll no : 39
if [ -f "$line" ]; then
if [ -r "$line" -a -w "$line" -a -x "$line" ]; then
echo "$line has all the permissions."
fi
fi
done
Output
Name : Aditya B. Thakare Practical no : 13
Roll no : 39
3.Write a shell script which accepts a filename and assign it all the
permissions.
Output