Skip to main content
11 events
when toggle format what by license comment
Dec 16, 2020 at 11:55 vote accept Invisible999
Dec 8, 2020 at 11:16 comment added Cyrus @OleTange: This is an important issue. In this case, a solution with find would be even longer: find . -maxdepth 1 ! -path . -printf "%f\0"
Dec 7, 2020 at 23:53 comment added Ole Tange @Cyrus You will still get . in your output. So you need to remove that, too.
Dec 7, 2020 at 19:07 comment added Cyrus @OleTange: I would have used find -maxdepth 1 -printf "%f\0" but your suggestion is probably easier to remember and with bash it's a builtin.
Dec 7, 2020 at 19:00 comment added Ole Tange @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).
Dec 7, 2020 at 18:37 comment added Cyrus @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.
Dec 7, 2020 at 17:14 comment added Ole Tange @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.
Dec 6, 2020 at 12:16 comment added Invisible999 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.
Dec 5, 2020 at 11:45 answer added Kamil Maciorowski timeline score: 2
Dec 5, 2020 at 9:38 comment added Cyrus Please note: Why not parse ls?
Dec 5, 2020 at 9:20 history asked Invisible999 CC BY-SA 4.0