Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #238233
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Bash script problem |
| Date | 2021-08-06 02:30 +0200 |
| Message-ID | <CIVUl-1lo-3@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <CIRQJ-7vr-1@gated-at.bofh.it> <CIV7X-QV-1@gated-at.bofh.it> <CIVAZ-1fl-3@gated-at.bofh.it> <CIVAZ-1fl-1@gated-at.bofh.it> <CIVKF-1it-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> >> find . -type d -exec chmod -v 0644 '{}' \;
> > Use + instead of \; to make them more efficient.
> What does + make as a difference ?
It's a replacement for xargs, except that it actually works, unlike
xargs, which is horribly broken without GNU extensions.
find . -type d -exec chmod 755 {} +
is equivalent to
find . -type d -print0 | xargs -0 chmod 755
except that the former is (a) faster, (b) shorter, and (c) POSIX standard.
Both of them try to minimize the number of separate calls to chmod, by
bundling up a bunch of filenames and passing them all at once.
The \; command calls chmod one time for every directory.
There are valid reasons to use the \; form (e.g. when your command can
only handle one filename at a time), and there are valid reasons to
use the -print0 | xargs -0 form (e.g. when you want to parallelize,
which is another GNU xargs extension). But in this particular case,
the -exec + command is the best choice.
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Bash script problem "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-05 02:00 +0200
Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-05 02:10 +0200
Re: Bash script problem "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-05 05:50 +0200
Re: Bash script problem john doe <johndoe65534@mail.com> - 2021-08-05 09:00 +0200
Re: Bash script problem <tomas@tuxteam.de> - 2021-08-05 10:10 +0200
Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-05 13:20 +0200
test vs. [ [was: Bash script problem] <tomas@tuxteam.de> - 2021-08-05 14:00 +0200
Re: test vs. [ [was: Bash script problem] Greg Wooledge <greg@wooledge.org> - 2021-08-05 14:40 +0200
Re: test vs. [ [was: Bash script problem] <tomas@tuxteam.de> - 2021-08-05 15:00 +0200
Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-05 14:30 +0200
Re: Bash script problem Anssi Saari <as@sci.fi> - 2021-08-05 09:40 +0200
Re: Bash script problem Tixy <tixy@yxit.co.uk> - 2021-08-05 10:30 +0200
Re: Bash script problem <tomas@tuxteam.de> - 2021-08-05 10:40 +0200
Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-05 14:00 +0200
Re: Bash script problem "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-05 22:10 +0200
Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-05 22:20 +0200
Re: Bash script problem "Gary L. Roach" <garyroach719@gmail.com> - 2021-08-06 17:00 +0200
Re: Bash script problem <tomas@tuxteam.de> - 2021-08-06 17:10 +0200
Re: Bash script problem David <bouncingcats@gmail.com> - 2021-08-06 01:40 +0200
Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-06 02:10 +0200
Re: Bash script problem Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-06 02:20 +0200
Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-06 02:30 +0200
Re: Bash script problem The Wanderer <wanderer@fastmail.fm> - 2021-08-06 03:50 +0200
Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-06 04:10 +0200
Re: Bash script problem Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-08-06 02:10 +0200
Re: Bash script problem Christian Groessler <chris@groessler.org> - 2021-08-06 02:30 +0200
Re: Bash script problem Christian Groessler <chris@groessler.org> - 2021-08-06 03:00 +0200
Re: Bash script problem Greg Wooledge <greg@wooledge.org> - 2021-08-06 03:10 +0200
Re: Bash script problem David <bouncingcats@gmail.com> - 2021-08-06 03:10 +0200
Re: Bash script problem David <bouncingcats@gmail.com> - 2021-08-06 03:00 +0200
Re: Bash script problem <tomas@tuxteam.de> - 2021-08-06 09:00 +0200
Re: Bash script problem David Wright <deblis@lionunicorn.co.uk> - 2021-08-06 05:10 +0200
Re: Bash script problem David <bouncingcats@gmail.com> - 2021-08-06 05:50 +0200
Re: Bash script problem Darac Marjal <mailinglist@darac.org.uk> - 2021-08-06 09:20 +0200
Re: Bash script problem Tom Browder <tom.browder@gmail.com> - 2021-08-06 01:00 +0200
csiph-web