4 ms·
xargs -P is not POSIX. Please don't use it if you ship your scripts to end users.
by Sir_Cmpwn 10y ago
xargs -P is not POSIX. Please don't use it if you ship your scripts to end users.
- oblio 10y agoWell, GNU Parallel is not POSIX either, so it boils down to which tool you want to ship instead.
- Sir_Cmpwn 10y agoWell, it's a different matter to depend on one standalone tool then to depend on a specific coreutils.
- duskwuff 10y agoI'd bet on GNU xargs being more likely to be installed than GNU Parallel. One of the two is part of a standard package that all Linux systems, and many non-Linux systems, have installed. The other is a special-purpose tool.
- Sir_Cmpwn 10y ago>I'd bet on GNU xargs being more likely to be installed than GNU Parallel. Your bet is irrelevant in the face of widely implemented standards. POSIX will outlive GNU coreutils. I'd bet your system also probably has a package manager that makes it easy to mark parallel as a dependency of your software. >many non-Linux systems Linux is pretty much the only system that typically ships GNU coreutils. The only one that comes to mind is Hurd.
- cstrahan 10y agoFor use within scripts, I think it's a much easier matter to determine that parallel is on $PATH than to try to do feature detection on xargs. Granted, it's always possible that the parallel on $PATH might not be the one you're thinking of, but... Whatevs.
- ole_tange 10y ago> Granted, it's always possible that the parallel on $PATH might not be the one you're thinking of, but... Whatevs. For exactly this reason, GNU Parallel has the option --minversion. So in your script you put: parallel --minversion 20140722 || exit if the rest of your script depends on functionality only present from version 20140722. If the parallel in the $PATH is not GNU Parallel it will fail (and thus exit). If it _is_ GNU Parallel it will fail if the version is < 20140722 and succeed otherwise.
- deleted 10y ago[deleted]
- justincormack 10y agoIt is supported outside Gnu though, eg on FreeBSD.