Answer to Question #306603 in UNIX/Linux Programming for Mickey

Question #306603

Write a menu driven shell script to list all the files of the current directory having read, write permission and read write permission to the user.

a.     Read permission

b.     Write permission

c.      Read and write permission

d.     exit 

1
Expert's answer
2022-03-06T14:04:49-0500
# Shell script to display list of file names
# having read, Write and Execute permission
echo "The name of all files having all permissions :"
  
# loop through all files in current directory
for file in *
do

# check if it is a file
if [ -f $file ]
then

# check if it has all permissions
if [ -r $file -a -w $file -a -x $file ]
then

# print the complete file name with -l option
ls -l $file

# closing second if statement
fi

# closing first if statement
fi

done

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS