I was able to install GNU Parallel globally in git-bash by following this answer.
However, on running an example command as mentioned in the parallel-tutorial,
parallel -k echo ::: A B C > abc-file
I keep getting this error
sh: -c: option requires an argument
sh: -c: option requires an argument
sh: -c: option requires an argument
.
.
.
What am I doing wrong here?
So the root cause is that CygWin (contrary to GNU/Linux) does not respect redirection of STDERR if the command line is too long.
GNU Parallel figures out how long the longest possible command line is by doing a binary search for the length. This is awfully slow on CygWin because forking a 12 MB command line is horribly slow (and 12 MB seems to be the limit in my version of CygWin).
Luckily it only has do be done once. After this GNU Parallel caches the line length in ~/.parallel/tmp/HOSTNAME/linelen
, and this is the reason why you experience the problem when ~/.parallel/tmp
is removed.
This is also the reason why it seemed that using a different version worked: You simply had a single run that finished, and thus cached the length. It was not the change of version that did this.
Until I manage to get CygWin to ignore the sh: -c: option requires an argument
all you need to do is to ignore it and be patient. I should probably also put in a small warning, to let CygWin users know that they have to be patient the first time.
Run:
parallel echo ::: 1
It will spit out the sh: -c: option requires an argument
around 25 times, but that is fine. It will take around 30 seconds to complete.
After this everything should be fast(er) and you should not see the error.
It should be fixed in the newest version in GIT: https://savannah.gnu.org/git/?group=parallel