Register
It is currently Wed Oct 01, 2014 8:13 am

read all directories with world wide access


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Mon May 13, 2013 8:27 am   

Joined: Mon May 13, 2013 8:20 am
Posts: 1
I want to read all directories with world wide access and without stickibit

1) I use the following command
Code:
find /  -type d -perm -002 ! -perm -1000  -exec ls -d {} \; 2>/dev/null;

all is ok

2) When i use the following bash-script it does not work
Code:
#/bin/bash
for file02 in `find /  -type d -perm -002 ! -perm -1000  -exec ls -d {} \; 2>/dev/null;`;
do
        echo "02) DANGER : ${file02}  is a world writable directory, it should have the sticky bit on."
done | sort


My Question: Why does the bash-script not work


Top
 Profile  
 PostPosted: Mon May 13, 2013 2:35 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 549
hi,

using ls -d with find is silly, if you're looking for directories tell find to do it with the -type d instruction.

«it's not working», but how is it not working?
you shouldn't use a for loop to read the output of a command, because the for loop loops over words, not lines.
instead pipe it to a while loop.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP