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



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

Answer / 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

More Shell Script Interview Questions

write a scwipt that a) takes exactly one argument, a directory name. b) if the number of argument is more or less than one,print a usage message c) if the argument is not adirectory, print another message d) for the given directory, print the five biggest files and the five files that were most recently modified. e) save the output to a file called q2output.

2 Answers  


write a shell script that counts a number of unique word contained in the file and print them in alphabetical order line by line?

6 Answers   IBM, Wipro,


write a shell script to identify the given string is palindrome or not?

17 Answers   CTS, HP, IBM, InfoEst, Wipro,


Please give me example of " at command , contrab command " how to use

0 Answers  


How to sort a result of Ls -l command based on columns. Ex. i want to sort 5th column from output of ls -l command.

6 Answers   TCS,


Write down the syntax for all the loops in shell scripting.

0 Answers  


Dear All, Can anybody tell me how to predefind no. of selected rows from a text file.

1 Answers   MGL,


How to get script name inside a script?

0 Answers  


What is the use of "$?" Sign in shell script?

0 Answers  


What are the advantages of shell scripting?

0 Answers  


Determine the output of the following command: name=shubham && echo ‘my name is $name’.

0 Answers  


what are command line arguments? what is the need of those?

1 Answers   Flipkart,


Categories