IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User

Welcome to IWETHEY!

New I don't follow
I would expect if I watched top while Ben's is running, I'd see one instance of find and one instance of chmod that would live until everything was done. With Mike's I'd expect to see one instance of find which would finish as soon as the file list is created, and a new instance of chmod would appear for each file.

So if process creation was the bottleneck, I'd expect Mike's to be faster.

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
New Exact opposite.
find -exec chmod calls 'chmod somefile' for each file it finds. It has to, because it can't know how that particular executable works. In order to keep one around and use it, some sort of piping would be necessary.

find | xargs chmod will instead gather up all the file names, turn them into a single string via xargs, then pass that string as args to chmod. Run 'find . -type f | xargs' sometime to see what it does.

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Not necessarily a *single* string
xargs will break up long lists so that you fit inside the limits for the length of a command line.

a very rich person should leave his kids enough to do anything but not enough to do nothing. -- Warren Buffett
New Okay, makes sense
In my limited use of scripting, I must have gotten lucky in that I found piping more clear conceptually than calling -exec or other optional parameters on various commands.

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
     Quick bash script help needed - (inthane-chan) - (12)
         find . -type f -exec chmod 774 '{}' #untested -NT - (ben_tilly) - (11)
             find . -type f -print | xargs chmod 774 #untested/same thing -NT - (Yendor) - (9)
                 Mine is safer (newlines in filenames) -NT - (ben_tilly) - (8)
                     Mine is bigger - (Yendor) - (7)
                         Who uses a newline in a filename? - (ben_tilly) - (6)
                             Why? - (drewk) - (5)
                                 'find' starts a process for each iteration of exec - (admin) - (4)
                                     I don't follow - (drewk) - (3)
                                         Exact opposite. - (admin) - (2)
                                             Not necessarily a *single* string - (ben_tilly)
                                             Okay, makes sense - (drewk)
             Thanks. - (inthane-chan)

Between our quests we sequin vests and impersonate Clark Gable.
61 ms