unix dirpath script

November 24, 2010 at 15:49:36
Specs: Windows 7
Hey guys,

I have to make a script called dirpath that will show a formatted listing of permissions of a directory, and of all the directories in its path, starting from the root directory. It should work if the directory is specified using absolute or relative path. If not listed like that it will just execute for the current working directory. The script also highlights the directory which don't have execute permissions for other users.

Ex of output:

dirpath dir1
Owner Group Other Filename
----- ----- ----- --------
d r w x r - x r - x /
d r - x r - x r - x home
d r w x - - x - - t user
d r w x - - x - - x public
d r w x - - x - - - notes(this would be highlighted)
d r w x - - x - - x files
d r w x - - x - - x dir1

Does anyone have any idea how I would go about starting this and how I can highlight things?


See More: unix dirpath script

Report •

#1
December 1, 2010 at 20:03:09
Without looking at your script, it is difficult to make a recommendation. However, you can look at the tput command and, depending on your logic, put a:

tput bold or tput rev on any directory that exists and does not have execute permission set for other users.

Here is a tree script that I posted a few years ago. You might get some ideas from it:

http://www.computing.net/answers/un...


Report •
Related Solutions


Ask Question