News for hackers. Stuff that matters.
Re:Filenames and Pathnames in Shell: How to Do It Correctly by unixhero on Tuesday June 20, 2023 @04:20AM (#36401112)
Can you elaborate?

Do you prefix the find line there eith a backtick?

It looks robust, and I am interested in using this technique

Re:Filenames and Pathnames in Shell: How to Do It Correctly by metadat on Tuesday June 20, 2023 @01:04PM (#36407093)
Here are a few examples of how I safely traverse filesystem contents in bash:

  find . -print0 | xargs -0 -n1 ./sub_script.sh

  find . -mindepth 1 -maxdepth 1 -name '*some*pattern' -print0 \
    | xargs -0 -n1 -I{} /usr/bin/env bash -c \
      'printf "%s" "$*"' _ {}