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

What is scripting used for?

566


Explain about shebang?

624


What is .sh file in mac?

561


How do I run a script on mac?

572


is this growing field and what is average package in this?

1878






How can you get the value of pi till a 100 decimal places?

557


What is $1 in shell scripting?

593


State the advantages of shell scripting?

598


What is the fastest scripting language?

554


Why are shell scripts used?

626


What is @echo off?

571


I want to create a directory such that anyone in the group can create a file and access any person's file in it but none should be able to delete a file other than the one created by himself.

599


Explain about debugging?

606


Is shell scripting a programming language?

579


What are the zombie processes?

569