env_parallel: Documentation added.

This commit is contained in:
Ole Tange 2016-03-22 20:09:18 +01:00
parent feb914f4ef
commit f406518899
8 changed files with 479 additions and 95 deletions

View file

@ -213,10 +213,9 @@ cc:Tim Cuthbertson <tim3d.junk@gmail.com>,
Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>,
Jesse Alama <jesse.alama@gmail.com>
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/
<<No new functionality was introduced so this is a good candidate for a stable release.>>
@ -242,15 +241,18 @@ for Big Data Applications https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumb
* <<Citation needed: Introspecting for RSA Key Material to Assist Intrusion Detection http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=7331177&url=http%3A%2F%2Fieeexplore.ieee.org%2Fxpls%2Fabs_all.jsp%3Farnumber%3D7331177>>
* 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.

View file

@ -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

View file

@ -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)

View file

@ -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"

49
src/env_parallel Executable file
View file

@ -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 <http://www.gnu.org/licenses/>
# 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

30
src/env_parallel.pdksh Executable file
View file

@ -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 <http://www.gnu.org/licenses/>
# 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;
}

308
src/env_parallel.pod Normal file
View file

@ -0,0 +1,308 @@
#!/usr/bin/perl -w
=encoding utf8
=head1 NAME
env_parallel - export environment to GNU parallel
=head1 SYNOPSIS
B<env_parallel> [options for GNU Parallel]
=head1 DESCRIPTION
B<env_parallel> 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<parallel>.
=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<parallel>.
=head1 AUTHOR
When using GNU B<parallel> 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<xargs> compatibility is inspired by
the manual of B<xargs> 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 <http://www.gnu.org/licenses/>.
=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 Share>
to copy, distribute and transmit the work
=item B<to Remix>
to adapt the work
=back
Under the following conditions:
=over 9
=item B<Attribution>
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<Share Alike>
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<Waiver>
Any of the above conditions can be waived if you get permission from
the copyright holder.
=item B<Public Domain>
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<Other Rights>
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<Notice>
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<env_parallel> uses GNU B<parallel>.
=head1 SEE ALSO
B<parallel>(1), B<bash>(1), B<ksh>(1), B<zsh>(1), B<ksh>(1),
B<pdksh>(1)
=cut

View file

@ -80,80 +80,22 @@ similar to B<cat | sh>.
The I<command> must be an executable, a script, a composed command, or
a function.
B<Bash functions>: B<export -f> the function first.
B<Bash functions>: B<export -f> the function first or use B<env_parallel>.
B<Bash aliases>: Copy the full environment using this and use B<env_parallel> instead of B<parallel>.
B<Bash aliases>: Use B<env_parallel>.
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<Ksh functions and aliases>: Use B<env_parallel>.
B<Ksh functions>: If it is a Ksh function you can encode the function in a variable:
B<Zsh functions>: Use B<env_parallel>.
foo() {
echo $*;
}
export PARALLEL_ENV=`typeset -f foo`
parallel foo ::: works
B<Zsh aliases>: No solution.
To export all functions, aliases, and variables and also make them available when running remote:
B<Fish functions and aliases>: Use B<env_parallel>.
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<Ksh functions and aliases>: Use B<env_parallel>.
B<Zsh functions>: If it is a Zsh function you can encode the function in a variable:
B<Pdksh functions and aliases>: Use B<env_parallel>.
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<Fish functions>: 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: ¯).