write a shell script to check whether all the directories
in the path exist has read and write permission

Answer Posted / geichel

#!/bin/bash

for x in $(echo $PATH |sed "s/:/ /g")
do
echo "Directories in your PATH which you cannot write are:"
echo $(find $x -perm /666 -type d -maxdepth 0 2>/dev/null
|xargs ls -dl | grep -v $USER)
done

exit 0;

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How does shell scripting work?

607


Differentiate between ‘ and ” quotes.

606


What does egrep mean?

561


What is subshell?

524


How to get script name inside a script?

540






What is a shell script? Can you name some of its advantages?

522


What does sh mean?

612


Is shell script a programming language?

562


What is a file basename?

584


How do I run a shell script on a mac?

620


What is a boot block?

571


What are the advantages of shell scripting?

580


What is the significance of the shebang line in shell scripting?

525


What are different types of shell?

484


What makes c shell a more preferable option than the bourne shell?

532