Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • Please note: Why not parse ls?
    – Cyrus
    Commented Dec 5, 2020 at 9:38
  • If you checked closely, the example was taken directly from parallel's documentation for illustrative purposes. I am not using ls, you can direct your valid concerns to those who wrote parallel's documentation. Thanks. Commented Dec 6, 2020 at 12:16
  • @Cyrus Parsing ls (without any options) is in practice safe if you know your filenames do not contain newlines. In my 25 years of sysadmin I have only seen that from malicious users, f*cked filesystems, or test files I have created myself.
    – Ole Tange
    Commented Dec 7, 2020 at 17:14
  • @OleTange: I agree that in this case it is fine as long as the filename does not contain newlines. For safety reasons I recommend switching to GNU find's and parallel's -0.
    – Cyrus
    Commented Dec 7, 2020 at 18:37
  • @Cyrus The alternative is not find because you need to disable recursion and remove ./ from the . The alternative is printf "%s\0" * (but it does not work in *csh if the list is too long).
    – Ole Tange
    Commented Dec 7, 2020 at 19:00