Carlos E. R. wrote:
On Friday, 2010-10-29 at 20:22 -0400, Lucky Leavell wrote:
On files/directories with no user, I want to change the user to nobody and likewise for the group. I could run the initial script twice, once to detect unowned files and the other to detect unowned groups and handle each separately. However, on some systems we have terabyte filesystems with millions of files and a single find command can run for days. Thus I would like to take this initial file and use that to correct both problems.
The problem I keep running into is with pathnames with embedded spaces. I have tried everything I can think of using shell scripts, awk and perl and they all have problems with pathnames with embedded spaces.
I simply write the names to a file, one file per line. Then a while loop reads them, one by one:
while read FILES ; do WorkOn "$FILES" done < $LISTOFFILES
This works neither for files with spaces nor for files with newlines in them. The former can be solved by setting IFS. The latter can be solved by not using Shell, but Perl or Python. Actually, my preferred way to solve that problem would be to execute find2perl / -nouser -o -nogroup >no-user-group.pl and then edit no-user-group.pl to add appropriate chown and chgrp actions. Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod Email: jschrod@acm.org Roedermark, Germany -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org