I have this:
chmod u+x $(find scripts -name "*.sh")
But I believe it's only running chmod u+x for the first item in the list from find, since the results are newline separated.
How can I run chmod u+x for each item returned from the find call?
My guess is that xargs is the best way? something like this:
find scripts -name "*.sh" | xargs chmod u+x
chmod u+x
(or any similar command) can handle that – Alexander Mills Apr 27 '18 at 06:53chmod
doesn’t need to handle newlines in the result of a command substitution: the shell parses everything (and it removes newlines from the output). – Stephen Kitt Apr 30 '18 at 09:02