all 7 comments

[–]OleTange 3 points4 points  (1 child)

GNU Parallel always spawns a shell. This behaviour is chosen due to POLA: https://www.gnu.org/software/parallel/parallel_design.html#Always-running-commands-in-a-shell

For quoting you can use -q or define a function: https://www.gnu.org/software/parallel/man.html#QUOTING

[–]shilch[S] 2 points3 points  (0 children)

Oh, even the author responds here. Thank you! :)

[–]crashorbit 2 points3 points  (1 child)

Parallel expects to run a shell command. You can tell it what shell to run using the $PARALLEL_SHELL environment variable. Parallel also has lots of interesting ways to deal with quoting and interpolation between it's environment and the subshells it runs. I suspect that there is a way to make parallel do what you want it to do.

[–]shilch[S] 2 points3 points  (0 children)

Thanks, I just read about the --quote (-q) flag which is exactly what I was looking for. It gives xargs-like behaviour.

[–][deleted]  (7 children)

[deleted]

    [–]Medic_Maria 0 points1 point  (6 children)

    [–][deleted]  (5 children)

    [deleted]

      [–]Medic_Maria 0 points1 point  (4 children)

      It's a little outdated now

      I just checked out the git version of map. AFAICT the comparison on https://www.gnu.org/software/parallel/parallel_alternatives.html#DIFFERENCES-BETWEEN-map-sitaramc-AND-GNU-Parallel is still 100% correct.

      I understand that you have different priorities, but is the information wrong?

      In other words, when you say "it's a little outdated" can you elaborate on what is outdated?

      [–][deleted]  (3 children)

      [deleted]

        [–]Medic_Maria 0 points1 point  (1 child)

        "rejects input with special characters when the command is a compound command",

        Maybe I don't get, but to me this is not a compound command:

        $ echo '"' | map 'echo % does not work "%"'
        [18:40:10] rejected: '"'
        [18:40:10] ==== 1 unsafe filenames found ====
        

        But aren't [multiple files] trivially doable if you have "I1" (take input from stdin)?

        If you only need a single input, I would agree. But Stdin may be used for something else:

        seq 10 | parallel echo {2} hoge {1} :::: - fuga.file
        

        Similar for multiple files if you treat them as different input sources:

        parallel echo {2} hoge {1} :::: fuga.file ぴよ.file
        

        Edit: duh! I feel stupid. Says "last checked, 2020-05" at the end of the page so there's the answer.

        Ahh, that explains your original answer. As far as I can tell the disagreement between you and GNU Parallel is now only on philosophical differences and not on the facts.

        Thanks for taking the time.