c program to check whether all the directories in the path
exists has read and write permission

Answer Posted / rakesh

#!/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 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How will you emulate wc –l using awk?

913


What is a command line shell?

568


Explain about debugging?

606


Why is shell scripting important?

578


What language is bash written in?

567






Explain about "s" permission bit in a file?

619


What will happen to my current process when I execute a command using exec?

539


Explore about environment variables?

599


What are the 3 standard streams in linux?

576


Where are cowrie shells found?

582


What are scripts in psychology?

601


How to debug the problems encountered in the shell script/program?

632


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

557


In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

642


What is eval in shell script?

653