From f40651889944dcec97bcd0ad12efacf4b238845e Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Tue, 22 Mar 2016 20:09:18 +0100 Subject: [PATCH] env_parallel: Documentation added. --- doc/release_new_version | 12 +- .../obs/home:tange/parallel/parallel.spec | 7 +- src/Makefile.am | 47 ++- src/Makefile.in | 47 ++- src/env_parallel | 49 +++ src/env_parallel.pdksh | 30 ++ src/env_parallel.pod | 308 ++++++++++++++++++ src/parallel.pod | 74 +---- 8 files changed, 479 insertions(+), 95 deletions(-) create mode 100755 src/env_parallel create mode 100755 src/env_parallel.pdksh create mode 100644 src/env_parallel.pod diff --git a/doc/release_new_version b/doc/release_new_version index 3335ae43..777d1db2 100644 --- a/doc/release_new_version +++ b/doc/release_new_version @@ -213,10 +213,9 @@ cc:Tim Cuthbertson , Ryoichiro Suzuki , Jesse Alama -Subject: GNU Parallel 20160322 ('Gravitational') released <<[stable]>> -Scott Kelly, Hillary Donald +Subject: GNU Parallel 20160322 ('Bruxelles') released <<[stable]>> -GNU Parallel 20160322 ('Gravitational') <<[stable]>> has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/ +GNU Parallel 20160322 ('Bruxelles') <<[stable]>> has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/ <> @@ -242,15 +241,18 @@ for Big Data Applications https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumb * <> +* env_parallel is a function that exports the environment (functions, aliases, variables, and arrays) to GNU Parallel. + +* niceload --prg now searches for substrings if no process with the name is found. + * GNU Parallel was cited in: Random Forest DBSCAN for USPTO Inventor Name Disambiguation http://arxiv.org/pdf/1602.01792.pdf -* GNU Parallel was mentioned with wrong citation in: Dual Level Parallel Computations for LargeScale High-Fidelity Database to Design Aerospace Vehicles http://www.nas.nasa.gov/assets/pdf/papers/Guruswamy_2013_DualLevelParallelComputations.pdf +* GNU Parallel was mentioned (with wrong citation) in: Dual Level Parallel Computations for LargeScale High-Fidelity Database to Design Aerospace Vehicles http://www.nas.nasa.gov/assets/pdf/papers/Guruswamy_2013_DualLevelParallelComputations.pdf * Using ‘Parallel’ in Unix https://shearnrylan.wordpress.com/2016/02/22/using-parallel-in-unix/ * JPEG Squish uses (and co-distributes) GNU Parallel: http://dantidswell.co.uk/jpeg-squish/ - * Bug fixes and man page updates. GNU Parallel - For people who live life in the parallel lane. diff --git a/packager/obs/home:tange/parallel/parallel.spec b/packager/obs/home:tange/parallel/parallel.spec index 4a271284..80f89794 100644 --- a/packager/obs/home:tange/parallel/parallel.spec +++ b/packager/obs/home:tange/parallel/parallel.spec @@ -1,6 +1,6 @@ Summary: Shell tool for executing jobs in parallel Name: parallel -Version: 20160222 +Version: 20160322 Release: 1.1 License: GPL Group: Productivity/File utilities @@ -56,18 +56,21 @@ make install prefix=$RPM_BUILD_ROOT%{_prefix} exec_prefix=$RPM_BUILD_ROOT%{_pref mandir=$RPM_BUILD_ROOT%{_mandir} rm $RPM_BUILD_ROOT%{_docdir}/parallel.html +rm $RPM_BUILD_ROOT%{_docdir}/env_parallel.html rm $RPM_BUILD_ROOT%{_docdir}/parallel_tutorial.html rm $RPM_BUILD_ROOT%{_docdir}/parallel_design.html rm $RPM_BUILD_ROOT%{_docdir}/niceload.html rm $RPM_BUILD_ROOT%{_docdir}/sem.html rm $RPM_BUILD_ROOT%{_docdir}/sql.html rm $RPM_BUILD_ROOT%{_docdir}/parallel.texi +rm $RPM_BUILD_ROOT%{_docdir}/env_parallel.texi rm $RPM_BUILD_ROOT%{_docdir}/parallel_tutorial.texi rm $RPM_BUILD_ROOT%{_docdir}/parallel_design.texi rm $RPM_BUILD_ROOT%{_docdir}/niceload.texi rm $RPM_BUILD_ROOT%{_docdir}/sem.texi rm $RPM_BUILD_ROOT%{_docdir}/sql.texi rm $RPM_BUILD_ROOT%{_docdir}/parallel.pdf +rm $RPM_BUILD_ROOT%{_docdir}/env_parallel.pdf rm $RPM_BUILD_ROOT%{_docdir}/parallel_tutorial.pdf rm $RPM_BUILD_ROOT%{_docdir}/parallel_design.pdf rm $RPM_BUILD_ROOT%{_docdir}/niceload.pdf @@ -82,7 +85,7 @@ rm -rf $RPM_BUILD_ROOT /usr/bin/* /usr/share/man/man1/* /usr/share/man/man7/* -%doc README NEWS src/parallel.html src/parallel_tutorial.html src/parallel_design.html src/sem.html src/sql.html src/niceload.html src/parallel.texi src/parallel_tutorial.texi src/parallel_design.texi src/niceload.texi src/sem.texi src/sql.texi src/parallel.pdf src/parallel_tutorial.pdf src/parallel_design.pdf src/niceload.pdf src/sem.pdf src/sql.pdf +%doc README NEWS src/parallel.html src/env_parallel.html src/parallel_tutorial.html src/parallel_design.html src/sem.html src/sql.html src/niceload.html src/parallel.texi src/env_parallel.texi src/parallel_tutorial.texi src/parallel_design.texi src/niceload.texi src/sem.texi src/sql.texi src/parallel.pdf src/env_parallel.pdf src/parallel_tutorial.pdf src/parallel_design.pdf src/niceload.pdf src/sem.pdf src/sql.pdf %changelog * Sat Jan 22 2011 Ole Tange diff --git a/src/Makefile.am b/src/Makefile.am index 0851cc06..a617a155 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,15 +1,15 @@ bin_SCRIPTS = parallel sql niceload \ - env_parallel.bash env_parallel.zsh env_parallel.fish env_parallel.ksh + env_parallel env_parallel.bash env_parallel.zsh env_parallel.fish env_parallel.ksh install-exec-hook: rm $(DESTDIR)$(bindir)/sem || true $(LN_S) parallel $(DESTDIR)$(bindir)/sem if DOCUMENTATION -man_MANS = parallel.1 sem.1 sql.1 niceload.1 parallel_tutorial.7 parallel_design.7 -doc_DATA = parallel.html sem.html sql.html niceload.html parallel_tutorial.html parallel_design.html \ - parallel.texi sem.texi sql.texi niceload.texi parallel_tutorial.texi parallel_design.texi \ - parallel.pdf sem.pdf sql.pdf niceload.pdf parallel_tutorial.pdf parallel_design.pdf +man_MANS = parallel.1 env_parallel.1 sem.1 sql.1 niceload.1 parallel_tutorial.7 parallel_design.7 +doc_DATA = parallel.html env_parallel.html sem.html sql.html niceload.html parallel_tutorial.html parallel_design.html \ + parallel.texi env_parallel.texi sem.texi sql.texi niceload.texi parallel_tutorial.texi parallel_design.texi \ + parallel.pdf env_parallel.pdf sem.pdf sql.pdf niceload.pdf parallel_tutorial.pdf parallel_design.pdf endif # Build documentation file if the tool to build exists. @@ -20,6 +20,12 @@ parallel.1: parallel.pod && mv $(srcdir)/parallel.1n $(srcdir)/parallel.1 \ || echo "Warning: pod2man not found. Using old parallel.1" +env_parallel.1: env_parallel.pod + pod2man --release='$(PACKAGE_VERSION)' --center='$(PACKAGE_NAME)' \ + --section=1 $(srcdir)/env_parallel.pod > $(srcdir)/env_parallel.1n \ + && mv $(srcdir)/env_parallel.1n $(srcdir)/env_parallel.1 \ + || echo "Warning: pod2man not found. Using old env_parallel.1" + parallel_tutorial.7: parallel_tutorial.pod pod2man --release='$(PACKAGE_VERSION)' --center='$(PACKAGE_NAME)' \ --section=7 $(srcdir)/parallel_tutorial.pod > $(srcdir)/parallel_tutorial.7n \ @@ -57,7 +63,14 @@ parallel.html: parallel.pod rm -f $(srcdir)/pod2htm* # Depending on parallel.html to avoid stupid pod2html race condition -parallel_tutorial.html: parallel_tutorial.pod parallel.html +env_parallel.html: env_parallel.pod parallel.html + pod2html --title "GNU Parallel with environment" $(srcdir)/env_parallel.pod > $(srcdir)/env_parallel.htmln \ + && mv $(srcdir)/env_parallel.htmln $(srcdir)/env_parallel.html \ + || echo "Warning: pod2html not found. Using old env_parallel.html" + rm -f $(srcdir)/pod2htm* + +# Depending on env_parallel.html to avoid stupid pod2html race condition +parallel_tutorial.html: parallel_tutorial.pod env_parallel.html pod2html --title "GNU Parallel tutorial" $(srcdir)/parallel_tutorial.pod > $(srcdir)/parallel_tutorial.htmln \ && mv $(srcdir)/parallel_tutorial.htmln $(srcdir)/parallel_tutorial.html \ || echo "Warning: pod2html not found. Using old parallel_tutorial.html" @@ -95,6 +108,10 @@ parallel.texi: parallel.pod pod2texi --output=$(srcdir)/parallel.texi $(srcdir)/parallel.pod \ || echo "Warning: pod2texi not found. Using old parallel.texi" +env_parallel.texi: env_parallel.pod + pod2texi --output=$(srcdir)/env_parallel.texi $(srcdir)/env_parallel.pod \ + || echo "Warning: pod2texi not found. Using old env_parallel.texi" + parallel_tutorial.texi: parallel_tutorial.pod pod2texi --output=$(srcdir)/parallel_tutorial.texi $(srcdir)/parallel_tutorial.pod \ || echo "Warning: pod2texi not found. Using old parallel_tutorial.texi" @@ -119,6 +136,10 @@ parallel.pdf: parallel.pod pod2pdf --output-file $(srcdir)/parallel.pdf $(srcdir)/parallel.pod --title "GNU Parallel" \ || echo "Warning: pod2pdf not found. Using old parallel.pdf" +env_parallel.pdf: env_parallel.pod + pod2pdf --output-file $(srcdir)/env_parallel.pdf $(srcdir)/env_parallel.pod --title "GNU Parallel with environment" \ + || echo "Warning: pod2pdf not found. Using old env_parallel.pdf" + parallel_tutorial.pdf: parallel_tutorial.pod pod2pdf --output-file $(srcdir)/parallel_tutorial.pdf $(srcdir)/parallel_tutorial.pod --title "GNU Parallel Tutorial" \ || echo "Warning: pod2pdf not found. Using old parallel_tutorial.pdf" @@ -142,12 +163,16 @@ niceload.pdf: niceload.pod sem: parallel ln -fs parallel sem -DISTCLEANFILES = parallel.1 sem.1 sql.1 niceload.1 parallel_tutorial.7 parallel_design.7 \ - parallel.html sem.html sql.html niceload.html parallel_tutorial.html parallel_design.html \ - parallel.texi sem.texi sql.texi niceload.texi parallel_tutorial.texi parallel_design.texi \ - parallel.pdf sem.pdf sql.pdf niceload.pdf parallel_tutorial.pdf parallel_design.pdf +DISTCLEANFILES = parallel.1 env_parallel.1 sem.1 sql.1 niceload.1 \ + parallel_tutorial.7 parallel_design.7 \ + parallel.html env_parallel.html sem.html sql.html niceload.html \ + parallel_tutorial.html parallel_design.html \ + parallel.texi env_parallel.texi sem.texi sql.texi niceload.texi \ + parallel_tutorial.texi parallel_design.texi \ + parallel.pdf env_parallel.pdf sem.pdf sql.pdf niceload.pdf \ + parallel_tutorial.pdf parallel_design.pdf -EXTRA_DIST = parallel sem sql niceload \ +EXTRA_DIST = parallel sem sql niceload env_parallel \ env_parallel.bash env_parallel.zsh env_parallel.fish env_parallel.ksh \ sem.pod parallel.pod niceload.pod parallel_tutorial.pod parallel_design.pod \ $(DISTCLEANFILES) diff --git a/src/Makefile.in b/src/Makefile.in index 41fc47da..e50ece64 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -218,19 +218,23 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ bin_SCRIPTS = parallel sql niceload \ - env_parallel.bash env_parallel.zsh env_parallel.fish env_parallel.ksh + env_parallel env_parallel.bash env_parallel.zsh env_parallel.fish env_parallel.ksh -@DOCUMENTATION_TRUE@man_MANS = parallel.1 sem.1 sql.1 niceload.1 parallel_tutorial.7 parallel_design.7 -@DOCUMENTATION_TRUE@doc_DATA = parallel.html sem.html sql.html niceload.html parallel_tutorial.html parallel_design.html \ -@DOCUMENTATION_TRUE@ parallel.texi sem.texi sql.texi niceload.texi parallel_tutorial.texi parallel_design.texi \ -@DOCUMENTATION_TRUE@ parallel.pdf sem.pdf sql.pdf niceload.pdf parallel_tutorial.pdf parallel_design.pdf +@DOCUMENTATION_TRUE@man_MANS = parallel.1 env_parallel.1 sem.1 sql.1 niceload.1 parallel_tutorial.7 parallel_design.7 +@DOCUMENTATION_TRUE@doc_DATA = parallel.html env_parallel.html sem.html sql.html niceload.html parallel_tutorial.html parallel_design.html \ +@DOCUMENTATION_TRUE@ parallel.texi env_parallel.texi sem.texi sql.texi niceload.texi parallel_tutorial.texi parallel_design.texi \ +@DOCUMENTATION_TRUE@ parallel.pdf env_parallel.pdf sem.pdf sql.pdf niceload.pdf parallel_tutorial.pdf parallel_design.pdf -DISTCLEANFILES = parallel.1 sem.1 sql.1 niceload.1 parallel_tutorial.7 parallel_design.7 \ - parallel.html sem.html sql.html niceload.html parallel_tutorial.html parallel_design.html \ - parallel.texi sem.texi sql.texi niceload.texi parallel_tutorial.texi parallel_design.texi \ - parallel.pdf sem.pdf sql.pdf niceload.pdf parallel_tutorial.pdf parallel_design.pdf +DISTCLEANFILES = parallel.1 env_parallel.1 sem.1 sql.1 niceload.1 \ + parallel_tutorial.7 parallel_design.7 \ + parallel.html env_parallel.html sem.html sql.html niceload.html \ + parallel_tutorial.html parallel_design.html \ + parallel.texi env_parallel.texi sem.texi sql.texi niceload.texi \ + parallel_tutorial.texi parallel_design.texi \ + parallel.pdf env_parallel.pdf sem.pdf sql.pdf niceload.pdf \ + parallel_tutorial.pdf parallel_design.pdf -EXTRA_DIST = parallel sem sql niceload \ +EXTRA_DIST = parallel sem sql niceload env_parallel \ env_parallel.bash env_parallel.zsh env_parallel.fish env_parallel.ksh \ sem.pod parallel.pod niceload.pod parallel_tutorial.pod parallel_design.pod \ $(DISTCLEANFILES) @@ -583,6 +587,12 @@ parallel.1: parallel.pod && mv $(srcdir)/parallel.1n $(srcdir)/parallel.1 \ || echo "Warning: pod2man not found. Using old parallel.1" +env_parallel.1: env_parallel.pod + pod2man --release='$(PACKAGE_VERSION)' --center='$(PACKAGE_NAME)' \ + --section=1 $(srcdir)/env_parallel.pod > $(srcdir)/env_parallel.1n \ + && mv $(srcdir)/env_parallel.1n $(srcdir)/env_parallel.1 \ + || echo "Warning: pod2man not found. Using old env_parallel.1" + parallel_tutorial.7: parallel_tutorial.pod pod2man --release='$(PACKAGE_VERSION)' --center='$(PACKAGE_NAME)' \ --section=7 $(srcdir)/parallel_tutorial.pod > $(srcdir)/parallel_tutorial.7n \ @@ -620,7 +630,14 @@ parallel.html: parallel.pod rm -f $(srcdir)/pod2htm* # Depending on parallel.html to avoid stupid pod2html race condition -parallel_tutorial.html: parallel_tutorial.pod parallel.html +env_parallel.html: env_parallel.pod parallel.html + pod2html --title "GNU Parallel with environment" $(srcdir)/env_parallel.pod > $(srcdir)/env_parallel.htmln \ + && mv $(srcdir)/env_parallel.htmln $(srcdir)/env_parallel.html \ + || echo "Warning: pod2html not found. Using old env_parallel.html" + rm -f $(srcdir)/pod2htm* + +# Depending on env_parallel.html to avoid stupid pod2html race condition +parallel_tutorial.html: parallel_tutorial.pod env_parallel.html pod2html --title "GNU Parallel tutorial" $(srcdir)/parallel_tutorial.pod > $(srcdir)/parallel_tutorial.htmln \ && mv $(srcdir)/parallel_tutorial.htmln $(srcdir)/parallel_tutorial.html \ || echo "Warning: pod2html not found. Using old parallel_tutorial.html" @@ -658,6 +675,10 @@ parallel.texi: parallel.pod pod2texi --output=$(srcdir)/parallel.texi $(srcdir)/parallel.pod \ || echo "Warning: pod2texi not found. Using old parallel.texi" +env_parallel.texi: env_parallel.pod + pod2texi --output=$(srcdir)/env_parallel.texi $(srcdir)/env_parallel.pod \ + || echo "Warning: pod2texi not found. Using old env_parallel.texi" + parallel_tutorial.texi: parallel_tutorial.pod pod2texi --output=$(srcdir)/parallel_tutorial.texi $(srcdir)/parallel_tutorial.pod \ || echo "Warning: pod2texi not found. Using old parallel_tutorial.texi" @@ -682,6 +703,10 @@ parallel.pdf: parallel.pod pod2pdf --output-file $(srcdir)/parallel.pdf $(srcdir)/parallel.pod --title "GNU Parallel" \ || echo "Warning: pod2pdf not found. Using old parallel.pdf" +env_parallel.pdf: env_parallel.pod + pod2pdf --output-file $(srcdir)/env_parallel.pdf $(srcdir)/env_parallel.pod --title "GNU Parallel with environment" \ + || echo "Warning: pod2pdf not found. Using old env_parallel.pdf" + parallel_tutorial.pdf: parallel_tutorial.pod pod2pdf --output-file $(srcdir)/parallel_tutorial.pdf $(srcdir)/parallel_tutorial.pod --title "GNU Parallel Tutorial" \ || echo "Warning: pod2pdf not found. Using old parallel_tutorial.pdf" diff --git a/src/env_parallel b/src/env_parallel new file mode 100755 index 00000000..7ef48e44 --- /dev/null +++ b/src/env_parallel @@ -0,0 +1,49 @@ +#!/bin/sh + +# Copyright (C) 2016 +# Ole Tange and Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see +# or write to the Free Software Foundation, Inc., 51 Franklin St, +# Fifth Floor, Boston, MA 02110-1301 USA + + +cat <<_EOS +env_parallel only works if it is a function. Do the below and restart your shell. + +bash: Put this in $HOME/.bashrc: . `which env_parallel.bash` + E.g. by doing: echo '. `which env_parallel.bash`' >> $HOME/.bashrc + Supports: aliases, functions, variables, arrays + +zsh: Put this in $HOME/.zshrc: . `which env_parallel.zsh` + E.g. by doing: echo '. `which env_parallel.zsh`' >> $HOME/.zshrc + Supports: functions, variables, arrays + +fish: Put this in $HOME/.config/fish/config.fish: + source (which env_parallel.fish) + E.g. by doing: + echo 'source (which env_parallel.fish)' >> $HOME/.config/fish/config.fish + Supports: aliases, functions, variables + +ksh: Put this in $HOME/.kshrc: source `which env_parallel.ksh` + E.g. by doing: echo 'source `which env_parallel.ksh`' >> $HOME/.kshrc + Supports: aliases, functions, variables, arrays + +pdksh: Put this in $HOME/.profile: source `which env_parallel.pdksh` + E.g. by doing: echo 'source `which env_parallel.pdksh`' >> $HOME/.profile + Supports: aliases, functions, variables, arrays + +For details: see man env_parallel + +_EOS diff --git a/src/env_parallel.pdksh b/src/env_parallel.pdksh new file mode 100755 index 00000000..86025d30 --- /dev/null +++ b/src/env_parallel.pdksh @@ -0,0 +1,30 @@ +# This file must be sourced in ksh: +# +# source `which env_parallel.ksh` +# +# after which 'env_parallel' works +# +# +# Copyright (C) 2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 +# Ole Tange and Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see +# or write to the Free Software Foundation, Inc., 51 Franklin St, +# Fifth Floor, Boston, MA 02110-1301 USA + +env_parallel() { + export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /';typeset -p|egrep -v 'typeset( -i)? -r|PIPESTATUS';typeset -f)"; + `which parallel` "$@"; + unset PARALLEL_ENV; +} diff --git a/src/env_parallel.pod b/src/env_parallel.pod new file mode 100644 index 00000000..4ff5eee8 --- /dev/null +++ b/src/env_parallel.pod @@ -0,0 +1,308 @@ +#!/usr/bin/perl -w + +=encoding utf8 + +=head1 NAME + +env_parallel - export environment to GNU parallel + + +=head1 SYNOPSIS + +B [options for GNU Parallel] + + +=head1 DESCRIPTION + +B is a shell function that exports the current +environment to GNU Parallel. + +If the shell function is not loaded, a dummy script will be run +instead that explains how to install the function. + + +=head1 OPTIONS + +Same as GNU B. + + +=head1 SUPPORTED SHELLS + +=head2 Bash + +=over 8 + +=item aliases + + alias myecho=echo + env_parallel myecho ::: test + +=item functions + + myfunc() { echo $*; } + env_parallel myfunc ::: test + +=item variables + + myvar=test + env_parallel echo '$myvar' ::: test + +=item arrays + + myarray=(foo bar baz) + env_parallel echo '${myarray[{}]}' ::: 0 1 2 + +=back + +=head2 Zsh + +=over 8 + +=item aliases + +Not supported + +=item functions + + myfunc() { echo $*; } + env_parallel myfunc ::: test + +=item variables + + myvar=test + env_parallel echo '$myvar' ::: test + +=item arrays + + myarray=(foo bar baz) + env_parallel echo '${myarray[{}]}' ::: 1 2 3 + +=back + +=head2 fish + +=over 8 + +=item aliases + + alias myecho=echo + env_parallel myecho ::: test + +=item functions + + function myfunc + echo $argv + end + env_parallel myfunc ::: test + +=item variables + + set myvar test + env_parallel echo '$myvar' ::: test + +=item arrays + +Not supported + +=back + +=head2 ksh + +=over 8 + +=item aliases + + alias myecho=echo + env_parallel myecho ::: test + +=item functions + + myfunc() { echo $*; } + env_parallel myfunc ::: test + +=item variables + + myvar=test + env_parallel echo '$myvar' ::: test + +=item arrays + + myarray=(foo bar baz) + env_parallel echo '${myarray[{}]}' ::: 0 1 2 + +=back + +=head2 pdksh + +=over 8 + +=item aliases + + alias myecho=echo + env_parallel myecho ::: test + +=item functions + + myfunc() { echo $*; } + env_parallel myfunc ::: test + +=item variables + + myvar=test + env_parallel echo '$myvar' ::: test + +=item arrays + + myarray=(foo bar baz) + env_parallel echo '${myarray[{}]}' ::: 0 1 2 + +=back + + +=head1 EXIT STATUS + +Same as GNU B. + + +=head1 AUTHOR + +When using GNU B for a publication please cite: + +O. Tange (2011): GNU Parallel - The Command-Line Power Tool, ;login: +The USENIX Magazine, February 2011:42-47. + +This helps funding further development; and it won't cost you a cent. +If you pay 10000 EUR you should feel free to use GNU Parallel without citing. + +Copyright (C) 2007-10-18 Ole Tange, http://ole.tange.dk + +Copyright (C) 2008,2009,2010 Ole Tange, http://ole.tange.dk + +Copyright (C) 2010,2011,2012,2013,2014,2015 Ole Tange, +http://ole.tange.dk and Free Software Foundation, Inc. + +Parts of the manual concerning B compatibility is inspired by +the manual of B from GNU findutils 4.4.2. + + +=head1 LICENSE + +Copyright (C) 2007,2008,2009,2010,2011,2012,2013,2014,2015 Free +Software Foundation, Inc. +v +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +at your option any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +=head2 Documentation license I + +Permission is granted to copy, distribute and/or modify this documentation +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, with no Front-Cover Texts, and with no Back-Cover +Texts. A copy of the license is included in the file fdl.txt. + +=head2 Documentation license II + +You are free: + +=over 9 + +=item B + +to copy, distribute and transmit the work + +=item B + +to adapt the work + +=back + +Under the following conditions: + +=over 9 + +=item B + +You must attribute the work in the manner specified by the author or +licensor (but not in any way that suggests that they endorse you or +your use of the work). + +=item B + +If you alter, transform, or build upon this work, you may distribute +the resulting work only under the same, similar or a compatible +license. + +=back + +With the understanding that: + +=over 9 + +=item B + +Any of the above conditions can be waived if you get permission from +the copyright holder. + +=item B + +Where the work or any of its elements is in the public domain under +applicable law, that status is in no way affected by the license. + +=item B + +In no way are any of the following rights affected by the license: + +=over 2 + +=item * + +Your fair dealing or fair use rights, or other applicable +copyright exceptions and limitations; + +=item * + +The author's moral rights; + +=item * + +Rights other persons may have either in the work itself or in +how the work is used, such as publicity or privacy rights. + +=back + +=back + +=over 9 + +=item B + +For any reuse or distribution, you must make clear to others the +license terms of this work. + +=back + +A copy of the full license is included in the file as cc-by-sa.txt. + + +=head1 DEPENDENCIES + +B uses GNU B. + + +=head1 SEE ALSO + +B(1), B(1), B(1), B(1), B(1), +B(1) + +=cut diff --git a/src/parallel.pod b/src/parallel.pod index 8b5399d0..5af2d3ab 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -80,80 +80,22 @@ similar to B. The I must be an executable, a script, a composed command, or a function. -B: B the function first. +B: B the function first or use B. -B: Copy the full environment using this and use B instead of B. +B: Use B. - env_parallel() { - export PARALLEL_ENV="$(echo "shopt -s expand_aliases 2>/dev/null"; alias;typeset -p | - grep -vFf <(readonly) | - grep -v 'declare .. (GROUPS|FUNCNAME|DIRSTACK|_|PIPESTATUS|USERNAME|BASH_[A-Z_]+) '; - typeset -f)"; - `which parallel` "$@"; - unset PARALLEL_ENV; - } - # call as: - env_parallel [normal parallel options] +B: Use B. -B: If it is a Ksh function you can encode the function in a variable: +B: Use B. - foo() { - echo $*; - } - export PARALLEL_ENV=`typeset -f foo` - parallel foo ::: works +B: No solution. -To export all functions, aliases, and variables and also make them available when running remote: +B: Use B. - env_parallel() { - export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /';typeset -p|egrep -v 'typeset( -i)? -r|PIPESTATUS';typeset -f)"; - `which parallel` "$@"; - unset PARALLEL_ENV; - } - # call as: - env_parallel [normal parallel options] +B: Use B. -B: If it is a Zsh function you can encode the function in a variable: +B: Use B. - foo() { - echo $*; - } - PARALLEL_ENV="$(typeset -f foo)"; - export PARALLEL_ENV - parallel foo ::: works - -To export all functions, aliases, and variables and also make them available when running remote: - - env_parallel() { - export PARALLEL_ENV="$(alias | perl -pe 's/^/alias /';typeset -p | - grep -aFvf <(typeset -pr)|egrep -iav 'ZSH_EVAL_CONTEXT|LINENO=| _=|aliases|^typeset [a-z_]+$'| - egrep -av '^(typeset IFS=|..$)|cyan'; - typeset -f)"; - parallel "$@"; - unset PARALLEL_ENV; - } - # call as: - env_parallel [normal parallel options] - -B: If it is a Fish function you can encode the function in a variable: - - function foo - echo $argv; - end - - setenv PARALLEL_ENV (functions foo|perl -pe 's/\n/\001/') - parallel foo ::: works - -To export all functions and simple variables (not arrays) and also make them available -when running remote: - - function env_parallel - setenv PARALLEL_ENV (begin; functions -n | perl -pe 's/,/\n/g' | while read d; functions $d; end; perl -e 'print map { "$_///$ENV{$_}\n"} grep !/^(PWD|SHLVL|PATH)$/, keys %ENV'| sh -c 'parallel --shellquote' | perl -pe 's:^([^/]+)///:setenv $1 :'; end |perl -pe 's/\001/\\cb/g;s/\n/\001/') - parallel $argv; - set -e PARALLEL_ENV - end - # call as: - env_parallel [normal parallel options] The command cannot contain the character \257 (macron: ¯).