.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "ENV_PARALLEL 1" .TH ENV_PARALLEL 1 2024-03-22 20240222 parallel .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME env_parallel \- export environment to GNU parallel .SH SYNOPSIS .IX Header "SYNOPSIS" \&\fBenv_parallel\fR [\-\-record\-env|\-\-session|\-\-end\-session] [options for GNU Parallel] .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBenv_parallel\fR is a shell function that exports the current environment to GNU \fBparallel\fR. .PP If the shell function is not loaded, a dummy script will be run instead that explains how to install the function. .PP \&\fBenv_parallel\fR is 100 ms slower at startup than pure GNU \fBparallel\fR, and takes up to 30% longer to start a job (typically 15 ms). .PP Due to the problem with environment space (see below) you are recommended only to transfer the environment that you need. .PP To help you do that, you can mark names that should not be transferred. This can be done with either \fB\-\-session\fR or \&\fB\-\-record\-env\fR. .PP .Vb 2 \& # Record the "clean" environment (this only needs to be run once) \& env_parallel \-\-record\-env \& \& # Optionally edit ~/.parallel/ignored_vars (only needed once) \& \& # Define whatever you want to use \& myfunc() { myalias and functions $myvar work. $1.; } \& alias myalias=\*(Aqecho Aliases\*(Aq \& myvar=\*(Aqand variables\*(Aq \& \& # Use \-\-env _ to only transfer the names not in the "empty" environment \& env_parallel \-\-env _ \-S localhost myfunc ::: Hooray .Ve .PP Or: .PP .Vb 2 \& # Do \-\-record\-env into $PARALLEL_IGNORED_NAMES \& env_parallel \-\-session \& \& # Define whatever you want to use \& myfunc() { myalias and functions $myvar work. $1.; } \& alias myalias=\*(Aqecho Aliases\*(Aq \& myvar=\*(Aqand variables\*(Aq \& \& # env_parallel will not export names in $PARALLEL_IGNORED_NAMES \& env_parallel \-S localhost myfunc ::: Hooray \& \& # Optionally \& env_parallel \-\-end\-session .Ve .PP In \fBcsh\fR \fB\-\-session\fR is not supported: .PP .Vb 2 \& # Record the "clean" environment \- this only needs to be run once \& env_parallel \-\-record\-env \& \& # Optionally edit ~/.parallel/ignored_vars \- only needed once \& \& # Define whatever you want to use \& alias myalias \*(Aqecho Aliases $myvar \e!*.\*(Aq \& set myvar=\*(Aqand variables\*(Aq \& \& # Use \-\-env _ to only transfer the names not in the "empty" environment \& env_parallel \-\-env _ \-S localhost myalias ::: work .Ve .SS "Environment space" .IX Subsection "Environment space" By default \fBenv_parallel\fR will export all environment variables, arrays, aliases, functions and shell options (see details for the individual shells below). .PP But this only works if the size of the current environment is smaller than the maximal length of a command and smaller than half of the max if running remotely. E.g. The max size of Bash's command is 128 KB, so \&\fBenv_parallel\fR will fail if '\fBset | wc \-c\fR' is bigger than 128 KB. Technically the limit is in \fBexecve\fR\|(1) which IPC::open3 uses. .PP Bash completion functions are well-known for taking up well over 128 KB of environment space and the primary reason for causing \&\fBenv_parallel\fR to fail. .PP Instead you can use \fB\-\-env\fR to specify which variables, arrays, aliases and functions to export as this will only export those with the given name. Or follow the recommended usage in shown in DESCRIPTION. .SH OPTIONS .IX Header "OPTIONS" Same as GNU \fBparallel\fR in addition to these: .IP \fB\-\-end\-session\fR 4 .IX Item "--end-session" Undo last \fB\-\-session\fR .IP \fB\-\-record\-env\fR 4 .IX Item "--record-env" Record all names currently defined to be ignored every time running \&\fBenv_parallel\fR in the future. .IP \fB\-\-session\fR 4 .IX Item "--session" Ignore all names currently defined. Aliases, variables, arrays, and functions currently defined will not be transferred. .Sp But names defined \fIafter\fR running \fBparallel \-\-session\fR \fIwill\fR be transferred. .Sp This is only valid in the running shell, and can be undone with \&\fBparallel \-\-end\-session\fR. .Sp You can run multiple \fB\-\-session\fR inside each other: .Sp .Vb 10 \& env_parallel \-\-session \& var=not \& # var is transferred \& env_parallel \-Slocalhost \*(Aqecho var is $var\*(Aq ::: ignored \& env_parallel \-\-session \& # var is not transferred \& env_parallel \-Slocalhost \*(Aqecho var is $var\*(Aq ::: ignored \& env_parallel \-\-end\-session \& # var is transferred again \& env_parallel \-Slocalhost \*(Aqecho var is $var\*(Aq ::: ignored .Ve .SH "SUPPORTED SHELLS" .IX Header "SUPPORTED SHELLS" .SS Ash .IX Subsection "Ash" \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.profile: .PP .Vb 1 \& . env_parallel.ash .Ve .PP E.g. by doing: .PP .Vb 1 \& echo \*(Aq. env_parallel.ash\*(Aq >> $HOME/.profile .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, or alias with the given name. Multiple \fB\-\-env\fRs can be given. .PP \&\fB\-\-session\fR is supported. .IP aliases 8 .IX Item "aliases" .Vb 5 \& alias myecho=\*(Aqecho aliases\*(Aq \& env_parallel myecho ::: work \& env_parallel \-S server myecho ::: work \& env_parallel \-\-env myecho myecho ::: work \& env_parallel \-\-env myecho \-S server myecho ::: work \& \& alias multiline=\*(Aqecho multiline \& echo aliases\*(Aq \& env_parallel multiline ::: work \& env_parallel \-S server multiline ::: work \& env_parallel \-\-env multiline multiline ::: work \& env_parallel \-\-env multiline \-S server multiline ::: work .Ve .IP functions 8 .IX Item "functions" .Vb 1 \& ash cannot list defined functions \- thus is not supported. .Ve .IP variables 8 .IX Item "variables" .Vb 5 \& myvar=variables \& env_parallel echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-S server echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar \-S server echo \*(Aq$myvar\*(Aq ::: work .Ve .IP arrays 8 .IX Item "arrays" Arrays are not supported by Ash. .SS Bash .IX Subsection "Bash" \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.bashrc: .PP .Vb 1 \& . env_parallel.bash .Ve .PP E.g. by doing: .PP .Vb 1 \& echo \*(Aq. env_parallel.bash\*(Aq >> $HOME/.bashrc .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, alias, function, or array with the given name. Multiple \fB\-\-env\fRs can be given. .PP \&\fB\-\-session\fR is supported. .IP aliases 8 .IX Item "aliases" .Vb 5 \& alias myecho=\*(Aqecho aliases\*(Aq \& env_parallel myecho ::: work \& env_parallel \-S server myecho ::: work \& env_parallel \-\-env myecho myecho ::: work \& env_parallel \-\-env myecho \-S server myecho ::: work \& \& alias multiline=\*(Aqecho multiline \& echo aliases\*(Aq \& env_parallel \*(Aqmultiline {}; \& echo but only when followed by a newline\*(Aq ::: work \& env_parallel \-S server \*(Aqmultiline {}; \& echo but only when followed by a newline\*(Aq ::: work \& env_parallel \-\-env multiline \*(Aqmultiline {}; \& echo but only when followed by a newline\*(Aq ::: work \& env_parallel \-\-env multiline \-S server \*(Aqmultiline {}; \& echo but only when followed by a newline\*(Aq ::: work .Ve .IP functions 8 .IX Item "functions" .Vb 5 \& myfunc() { echo functions $*; } \& env_parallel myfunc ::: work \& env_parallel \-S server myfunc ::: work \& env_parallel \-\-env myfunc myfunc ::: work \& env_parallel \-\-env myfunc \-S server myfunc ::: work .Ve .IP variables 8 .IX Item "variables" .Vb 5 \& myvar=variables \& env_parallel echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-S server echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar \-S server echo \*(Aq$myvar\*(Aq ::: work .Ve .IP arrays 8 .IX Item "arrays" .Vb 6 \& myarray=(arrays work, too) \& env_parallel \-k echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 \& env_parallel \-k \-S server echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 \& env_parallel \-k \-\-env myarray echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 \& env_parallel \-k \-\-env myarray \-S server \e \& echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 .Ve .PP \fIBUGS\fR .IX Subsection "BUGS" .PP Due to a bug in Bash, aliases containing newlines must be followed by a newline in the command. Some systems are not affected by this bug, but will print a warning anyway. .SS csh .IX Subsection "csh" \&\fBenv_parallel\fR for \fBcsh\fR breaks \fR\f(CB$PARALLEL\fR\fB\fR, so do not use \&\fB\fR\f(CB$PARALLEL\fR\fB\fR. .PP \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.cshrc: .PP .Vb 1 \& source \`which env_parallel.csh\` .Ve .PP E.g. by doing: .PP .Vb 1 \& echo \*(Aqsource \`which env_parallel.csh\`\*(Aq >> $HOME/.cshrc .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, alias, or array with the given name. Multiple \fB\-\-env\fRs can be given. .IP aliases 8 .IX Item "aliases" .Vb 5 \& alias myecho \*(Aqecho aliases\*(Aq \& env_parallel myecho ::: work \& env_parallel \-S server myecho ::: work \& env_parallel \-\-env myecho myecho ::: work \& env_parallel \-\-env myecho \-S server myecho ::: work .Ve .IP functions 8 .IX Item "functions" Not supported by \fBcsh\fR. .IP variables 8 .IX Item "variables" .Vb 5 \& set myvar=variables \& env_parallel echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-S server echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar \-S server echo \*(Aq$myvar\*(Aq ::: work .Ve .IP "arrays with no special chars" 8 .IX Item "arrays with no special chars" .Vb 6 \& set myarray=(arrays work, too) \& env_parallel \-k echo \e$\*(Aq{myarray[{}]}\*(Aq ::: 1 2 3 \& env_parallel \-k \-S server echo \e$\*(Aq{myarray[{}]}\*(Aq ::: 1 2 3 \& env_parallel \-k \-\-env myarray echo \e$\*(Aq{myarray[{}]}\*(Aq ::: 1 2 3 \& env_parallel \-k \-\-env myarray \-S server \e \& echo \e$\*(Aq{myarray[{}]}\*(Aq ::: 1 2 3 .Ve .SS Dash .IX Subsection "Dash" \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.profile: .PP .Vb 1 \& . env_parallel.dash .Ve .PP E.g. by doing: .PP .Vb 1 \& echo \*(Aq. env_parallel.dash\*(Aq >> $HOME/.profile .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, or alias with the given name. Multiple \fB\-\-env\fRs can be given. .PP \&\fB\-\-session\fR is supported. .IP aliases 8 .IX Item "aliases" .Vb 5 \& alias myecho=\*(Aqecho aliases\*(Aq \& env_parallel myecho ::: work \& env_parallel \-S server myecho ::: work \& env_parallel \-\-env myecho myecho ::: work \& env_parallel \-\-env myecho \-S server myecho ::: work \& \& alias multiline=\*(Aqecho multiline \& echo aliases\*(Aq \& env_parallel multiline ::: work \& env_parallel \-S server multiline ::: work \& env_parallel \-\-env multiline multiline ::: work \& env_parallel \-\-env multiline \-S server multiline ::: work .Ve .IP functions 8 .IX Item "functions" .Vb 1 \& dash cannot list defined functions \- thus is not supported. .Ve .IP variables 8 .IX Item "variables" .Vb 5 \& myvar=variables \& env_parallel echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-S server echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar \-S server echo \*(Aq$myvar\*(Aq ::: work .Ve .IP arrays 8 .IX Item "arrays" .Vb 1 \& dash does not support arrays. .Ve .SS fish .IX Subsection "fish" \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.config/fish/config.fish: .PP .Vb 1 \& source (which env_parallel.fish) .Ve .PP E.g. by doing: .PP .Vb 2 \& echo \*(Aqsource (which env_parallel.fish)\*(Aq \e \& >> $HOME/.config/fish/config.fish .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, alias, function, or array with the given name. Multiple \fB\-\-env\fRs can be given. .PP \&\fB\-\-session\fR is supported. .IP aliases 8 .IX Item "aliases" .Vb 5 \& alias myecho \*(Aqecho aliases\*(Aq \& env_parallel myecho ::: work \& env_parallel \-S server myecho ::: work \& env_parallel \-\-env myecho myecho ::: work \& env_parallel \-\-env myecho \-S server myecho ::: work .Ve .IP functions 8 .IX Item "functions" .Vb 7 \& function myfunc \& echo functions $argv \& end \& env_parallel myfunc ::: work \& env_parallel \-S server myfunc ::: work \& env_parallel \-\-env myfunc myfunc ::: work \& env_parallel \-\-env myfunc \-S server myfunc ::: work .Ve .IP variables 8 .IX Item "variables" .Vb 5 \& set myvar variables \& env_parallel echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-S server echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar \-S server echo \*(Aq$myvar\*(Aq ::: work .Ve .IP arrays 8 .IX Item "arrays" .Vb 6 \& set myarray arrays work, too \& env_parallel \-k echo \*(Aq$myarray[{}]\*(Aq ::: 1 2 3 \& env_parallel \-k \-S server echo \*(Aq$myarray[{}]\*(Aq ::: 1 2 3 \& env_parallel \-k \-\-env myarray echo \*(Aq$myarray[{}]\*(Aq ::: 1 2 3 \& env_parallel \-k \-\-env myarray \-S server \e \& echo \*(Aq$myarray[{}]\*(Aq ::: 1 2 3 .Ve .SS ksh .IX Subsection "ksh" \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.kshrc: .PP .Vb 1 \& source env_parallel.ksh .Ve .PP E.g. by doing: .PP .Vb 1 \& echo \*(Aqsource env_parallel.ksh\*(Aq >> $HOME/.kshrc .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, alias, function, or array with the given name. Multiple \fB\-\-env\fRs can be given. .PP \&\fB\-\-session\fR is supported. .IP aliases 8 .IX Item "aliases" .Vb 5 \& alias myecho=\*(Aqecho aliases\*(Aq \& env_parallel myecho ::: work \& env_parallel \-S server myecho ::: work \& env_parallel \-\-env myecho myecho ::: work \& env_parallel \-\-env myecho \-S server myecho ::: work \& \& alias multiline=\*(Aqecho multiline \& echo aliases\*(Aq \& env_parallel multiline ::: work \& env_parallel \-S server multiline ::: work \& env_parallel \-\-env multiline multiline ::: work \& env_parallel \-\-env multiline \-S server multiline ::: work .Ve .IP functions 8 .IX Item "functions" .Vb 5 \& myfunc() { echo functions $*; } \& env_parallel myfunc ::: work \& env_parallel \-S server myfunc ::: work \& env_parallel \-\-env myfunc myfunc ::: work \& env_parallel \-\-env myfunc \-S server myfunc ::: work .Ve .IP variables 8 .IX Item "variables" .Vb 5 \& myvar=variables \& env_parallel echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-S server echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar \-S server echo \*(Aq$myvar\*(Aq ::: work .Ve .IP arrays 8 .IX Item "arrays" .Vb 6 \& myarray=(arrays work, too) \& env_parallel \-k echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 \& env_parallel \-k \-S server echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 \& env_parallel \-k \-\-env myarray echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 \& env_parallel \-k \-\-env myarray \-S server \e \& echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 .Ve .SS mksh .IX Subsection "mksh" \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.mkshrc: .PP .Vb 1 \& source env_parallel.mksh .Ve .PP E.g. by doing: .PP .Vb 1 \& echo \*(Aqsource env_parallel.mksh\*(Aq >> $HOME/.mkshrc .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, alias, function, or array with the given name. Multiple \fB\-\-env\fRs can be given. .PP \&\fB\-\-session\fR is supported. .IP aliases 8 .IX Item "aliases" .Vb 5 \& alias myecho=\*(Aqecho aliases\*(Aq \& env_parallel myecho ::: work \& env_parallel \-S server myecho ::: work \& env_parallel \-\-env myecho myecho ::: work \& env_parallel \-\-env myecho \-S server myecho ::: work \& \& alias multiline=\*(Aqecho multiline \& echo aliases\*(Aq \& env_parallel multiline ::: work \& env_parallel \-S server multiline ::: work \& env_parallel \-\-env multiline multiline ::: work \& env_parallel \-\-env multiline \-S server multiline ::: work .Ve .IP functions 8 .IX Item "functions" .Vb 5 \& myfunc() { echo functions $*; } \& env_parallel myfunc ::: work \& env_parallel \-S server myfunc ::: work \& env_parallel \-\-env myfunc myfunc ::: work \& env_parallel \-\-env myfunc \-S server myfunc ::: work .Ve .IP variables 8 .IX Item "variables" .Vb 5 \& myvar=variables \& env_parallel echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-S server echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar \-S server echo \*(Aq$myvar\*(Aq ::: work .Ve .IP arrays 8 .IX Item "arrays" .Vb 6 \& myarray=(arrays work, too) \& env_parallel \-k echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 \& env_parallel \-k \-S server echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 \& env_parallel \-k \-\-env myarray echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 \& env_parallel \-k \-\-env myarray \-S server \e \& echo \*(Aq${myarray[{}]}\*(Aq ::: 0 1 2 .Ve .SS pdksh .IX Subsection "pdksh" \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.profile: .PP .Vb 1 \& source env_parallel.pdksh .Ve .PP E.g. by doing: .PP .Vb 1 \& echo \*(Aqsource env_parallel.pdksh\*(Aq >> $HOME/.profile .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, alias, function, or array with the given name. Multiple \fB\-\-env\fRs can be given. .PP \&\fB\-\-session\fR is supported. .IP aliases 8 .IX Item "aliases" .Vb 5 \& alias myecho="echo aliases"; \& env_parallel myecho ::: work; \& env_parallel \-S server myecho ::: work; \& env_parallel \-\-env myecho myecho ::: work; \& env_parallel \-\-env myecho \-S server myecho ::: work .Ve .IP functions 8 .IX Item "functions" .Vb 5 \& myfunc() { echo functions $*; }; \& env_parallel myfunc ::: work; \& env_parallel \-S server myfunc ::: work; \& env_parallel \-\-env myfunc myfunc ::: work; \& env_parallel \-\-env myfunc \-S server myfunc ::: work .Ve .IP variables 8 .IX Item "variables" .Vb 5 \& myvar=variables; \& env_parallel echo "\e$myvar" ::: work; \& env_parallel \-S server echo "\e$myvar" ::: work; \& env_parallel \-\-env myvar echo "\e$myvar" ::: work; \& env_parallel \-\-env myvar \-S server echo "\e$myvar" ::: work .Ve .IP arrays 8 .IX Item "arrays" .Vb 6 \& myarray=(arrays work, too); \& env_parallel \-k echo "\e${myarray[{}]}" ::: 0 1 2; \& env_parallel \-k \-S server echo "\e${myarray[{}]}" ::: 0 1 2; \& env_parallel \-k \-\-env myarray echo "\e${myarray[{}]}" ::: 0 1 2; \& env_parallel \-k \-\-env myarray \-S server \e \& echo "\e${myarray[{}]}" ::: 0 1 2 .Ve .SS sh .IX Subsection "sh" \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.profile: .PP .Vb 1 \& . env_parallel.sh .Ve .PP E.g. by doing: .PP .Vb 1 \& echo \*(Aq. env_parallel.sh\*(Aq >> $HOME/.profile .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, or alias with the given name. Multiple \fB\-\-env\fRs can be given. .PP \&\fB\-\-session\fR is supported. .IP aliases 8 .IX Item "aliases" .Vb 1 \& sh does not support aliases. .Ve .IP functions 8 .IX Item "functions" .Vb 5 \& myfunc() { echo functions $*; } \& env_parallel myfunc ::: work \& env_parallel \-S server myfunc ::: work \& env_parallel \-\-env myfunc myfunc ::: work \& env_parallel \-\-env myfunc \-S server myfunc ::: work .Ve .IP variables 8 .IX Item "variables" .Vb 5 \& myvar=variables \& env_parallel echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-S server echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar \-S server echo \*(Aq$myvar\*(Aq ::: work .Ve .IP arrays 8 .IX Item "arrays" .Vb 1 \& sh does not support arrays. .Ve .SS tcsh .IX Subsection "tcsh" \&\fBenv_parallel\fR for \fBtcsh\fR breaks \fR\f(CB$PARALLEL\fR\fB\fR, so do not use \&\fB\fR\f(CB$PARALLEL\fR\fB\fR. .PP \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.tcshrc: .PP .Vb 1 \& source \`which env_parallel.tcsh\` .Ve .PP E.g. by doing: .PP .Vb 1 \& echo \*(Aqsource \`which env_parallel.tcsh\`\*(Aq >> $HOME/.tcshrc .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, alias, or array with the given name. Multiple \fB\-\-env\fRs can be given. .IP aliases 8 .IX Item "aliases" .Vb 5 \& alias myecho \*(Aqecho aliases\*(Aq \& env_parallel myecho ::: work \& env_parallel \-S server myecho ::: work \& env_parallel \-\-env myecho myecho ::: work \& env_parallel \-\-env myecho \-S server myecho ::: work .Ve .IP functions 8 .IX Item "functions" Not supported by \fBtcsh\fR. .IP variables 8 .IX Item "variables" .Vb 5 \& set myvar=variables \& env_parallel echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-S server echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar \-S server echo \*(Aq$myvar\*(Aq ::: work .Ve .IP "arrays with no special chars" 8 .IX Item "arrays with no special chars" .Vb 6 \& set myarray=(arrays work, too) \& env_parallel \-k echo \e$\*(Aq{myarray[{}]}\*(Aq ::: 1 2 3 \& env_parallel \-k \-S server echo \e$\*(Aq{myarray[{}]}\*(Aq ::: 1 2 3 \& env_parallel \-k \-\-env myarray echo \e$\*(Aq{myarray[{}]}\*(Aq ::: 1 2 3 \& env_parallel \-k \-\-env myarray \-S server \e \& echo \e$\*(Aq{myarray[{}]}\*(Aq ::: 1 2 3 .Ve .SS Zsh .IX Subsection "Zsh" \fIInstallation\fR .IX Subsection "Installation" .PP Put this in \f(CW$HOME\fR/.zshrc: .PP .Vb 1 \& . env_parallel.zsh .Ve .PP E.g. by doing: .PP .Vb 1 \& echo \*(Aq. env_parallel.zsh\*(Aq >> $HOME/.zshenv .Ve .PP \fISupported use\fR .IX Subsection "Supported use" .PP \&\fB\-\-env\fR is supported to export only the variable, alias, function, or array with the given name. Multiple \fB\-\-env\fRs can be given. .PP \&\fB\-\-session\fR is supported. .IP aliases 8 .IX Item "aliases" .Vb 5 \& alias myecho=\*(Aqecho aliases\*(Aq \& env_parallel myecho ::: work \& env_parallel \-S server myecho ::: work \& env_parallel \-\-env myecho myecho ::: work \& env_parallel \-\-env myecho \-S server myecho ::: work \& \& alias multiline=\*(Aqecho multiline \& echo aliases\*(Aq \& env_parallel multiline ::: work \& env_parallel \-S server multiline ::: work \& env_parallel \-\-env multiline multiline ::: work \& env_parallel \-\-env multiline \-S server multiline ::: work .Ve .IP functions 8 .IX Item "functions" .Vb 5 \& myfunc() { echo functions $*; } \& env_parallel myfunc ::: work \& env_parallel \-S server myfunc ::: work \& env_parallel \-\-env myfunc myfunc ::: work \& env_parallel \-\-env myfunc \-S server myfunc ::: work .Ve .IP variables 8 .IX Item "variables" .Vb 5 \& myvar=variables \& env_parallel echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-S server echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar echo \*(Aq$myvar\*(Aq ::: work \& env_parallel \-\-env myvar \-S server echo \*(Aq$myvar\*(Aq ::: work .Ve .IP arrays 8 .IX Item "arrays" .Vb 6 \& myarray=(arrays work, too) \& env_parallel \-k echo \*(Aq${myarray[{}]}\*(Aq ::: 1 2 3 \& env_parallel \-k \-S server echo \*(Aq${myarray[{}]}\*(Aq ::: 1 2 3 \& env_parallel \-k \-\-env myarray echo \*(Aq${myarray[{}]}\*(Aq ::: 1 2 3 \& env_parallel \-k \-\-env myarray \-S server \e \& echo \*(Aq${myarray[{}]}\*(Aq ::: 1 2 3 .Ve .SH "EXIT STATUS" .IX Header "EXIT STATUS" Same as GNU \fBparallel\fR. .SH AUTHOR .IX Header "AUTHOR" When using GNU \fBenv_parallel\fR for a publication please cite: .PP O. Tange (2018): GNU Parallel 2018, March 2018, ISBN 9781387509881, DOI: 10.5281/zenodo.1146014. .PP Copyright (C) 2007\-10\-18 Ole Tange, http://ole.tange.dk .PP Copyright (C) 2008\-2010 Ole Tange, http://ole.tange.dk .PP Copyright (C) 2010\-2024 Ole Tange, http://ole.tange.dk and Free Software Foundation, Inc. .SH LICENSE .IX Header "LICENSE" 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. .PP 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. .PP You should have received a copy of the GNU General Public License along with this program. If not, see . .SS "Documentation license I" .IX Subsection "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 LICENSES/GFDL\-1.3\-or\-later.txt. .SS "Documentation license II" .IX Subsection "Documentation license II" You are free: .IP "\fBto Share\fR" 9 .IX Item "to Share" to copy, distribute and transmit the work .IP "\fBto Remix\fR" 9 .IX Item "to Remix" to adapt the work .PP Under the following conditions: .IP \fBAttribution\fR 9 .IX Item "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). .IP "\fBShare Alike\fR" 9 .IX Item "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. .PP With the understanding that: .IP \fBWaiver\fR 9 .IX Item "Waiver" Any of the above conditions can be waived if you get permission from the copyright holder. .IP "\fBPublic Domain\fR" 9 .IX Item "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. .IP "\fBOther Rights\fR" 9 .IX Item "Other Rights" In no way are any of the following rights affected by the license: .RS 9 .IP \(bu 2 Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; .IP \(bu 2 The author's moral rights; .IP \(bu 2 Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. .RE .RS 9 .RE .IP \fBNotice\fR 9 .IX Item "Notice" For any reuse or distribution, you must make clear to others the license terms of this work. .PP A copy of the full license is included in the file as LICENCES/CC\-BY\-SA\-4.0.txt .SH DEPENDENCIES .IX Header "DEPENDENCIES" \&\fBenv_parallel\fR uses GNU \fBparallel\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBparallel\fR(1), \fBash\fR(1), \fBbash\fR(1), \fBcsh\fR(1), \fBdash\fR(1), \&\fBfish\fR(1), \fBksh\fR(1), \fBpdksh\fR(1) \fBtcsh\fR(1), \fBzsh\fR(1).