1PARSET(1)                          parallel                          PARSET(1)
2
3
4

NAME

6       parset - set shell variables in parallel
7

SYNOPSIS

9       parset variablename [options for GNU Parallel]
10
11       env_parset variablename [options for GNU Parallel]
12

DESCRIPTION

14       parset is a shell function that puts the output from GNU parallel into
15       shell variables.
16
17       env_parset is a shell function that puts the output from env_parallel
18       into shell variables.
19
20       The parset and env_parset functions are defined as part of
21       env_parallel.
22
23       If variablename is a single variable name, this will be treated as the
24       destination variable. If the variable is defined as an associative
25       array (using typeset -A myassoc), this will be used. Otherwise the
26       variable will be made into a normal array.
27
28       If variablename contains multiple names separated by ',' or space, the
29       names will be the destination variables. The number of names must be at
30       least the number of jobs.
31

OPTIONS

33       Same as GNU parallel, but they are put after the destination variable.
34

SUPPORTED SHELLS

36   Bash/Zsh/Ksh/Mksh
37       Examples
38
39       Put output into myarray:
40
41         parset myarray seq 3 ::: 4 5 6
42         echo "${myarray[1]}"
43
44       Put output into vars $seq, $pwd, $ls:
45
46         parset "seq pwd ls" ::: "seq 10" pwd ls
47         echo "$ls"
48
49       Put output into vars $seq, $pwd, $ls:
50
51         into_vars=(seq pwd ls)
52         parset "${into_vars[*]}" ::: "seq 10" pwd ls
53         echo "$ls"
54
55       Put output into associative array myassoc (not supported for mksh):
56
57         typeset -A myassoc
58         parset myassoc seq ::: 4 5 ::: 6 7
59         echo "${myassoc[4 7]}"
60
61       The commands to run can be an array:
62
63         cmd=("echo first" "echo '<<joe  \"double  space\"  cartoon>>'" "pwd")
64         parset data ::: "${cmd[@]}"
65         echo "${data[1]}"
66         echo "${data[2]}"
67
68       parset can read from stdin (standard input) if it is a file:
69
70         parset res echo < parallel_input_file
71
72       but parset can not be part of a pipe. In particular this means it
73       cannot read from a pipe or write to a pipe:
74
75         seq 10 | parset res echo Does not work
76
77       but must instead use a tempfile:
78
79         seq 10 > parallel_input
80         parset res echo :::: parallel_input
81         echo "${res[1]}"
82         echo "${res[9]}"
83
84       or a FIFO:
85
86         mkfifo input_fifo
87         seq 30 > input_fifo &
88         parset res echo :::: input_fifo
89         echo "${res[1]}"
90         echo "${res[29]}"
91
92       or Bash/Zsh/Ksh process substitution:
93
94         parset res echo :::: <(seq 100)
95         echo "${res[1]}"
96         echo "${res[99]}"
97
98       Installation
99
100       Put this in the relevant $HOME/.bashrc or $HOME/.zshenv or
101       $HOME/.kshrc:
102
103         . `which env_parallel.bash`
104         . `which env_parallel.zsh`
105         source `which env_parallel.ksh`
106
107       E.g. by doing:
108
109         echo '. `which env_parallel.bash`' >> $HOME/.bashrc
110         echo '. `which env_parallel.zsh`' >> $HOME/.zshenv
111         echo 'source `which env_parallel.ksh`' >> $HOME/.kshrc
112
113       or by doing:
114
115         env_parallel --install
116
117   ash/dash (FreeBSD's /bin/sh)
118       Examples
119
120       ash does not support arrays.
121
122       Put output into vars $seq, $pwd, $ls:
123
124         parset "seq pwd ls" ::: "seq 10" pwd ls
125         echo "$ls"
126
127       parset can read from stdin (standard input) if it is a file:
128
129         parset res1,res2,res3 echo < parallel_input_file
130
131       but parset can not be part of a pipe. In particular this means it
132       cannot read from a pipe or write to a pipe:
133
134         seq 3 | parset res1,res2,res3 echo Does not work
135
136       but must instead use a tempfile:
137
138         seq 3 > parallel_input
139         parset res1,res2,res3 echo :::: parallel_input
140         echo "$res1"
141         echo "$res2"
142         echo "$res3"
143
144       or a FIFO:
145
146         mkfifo input_fifo
147         seq 3 > input_fifo &
148         parset res1,res2,res3 echo :::: input_fifo
149         echo "$res1"
150         echo "$res2"
151         echo "$res3"
152
153       Installation
154
155       Put the relevant one of these into $HOME/.profile:
156
157         . `which env_parallel.sh`
158         . `which env_parallel.ash`
159         . `which env_parallel.dash`
160
161       E.g. by doing:
162
163         echo '. `which env_parallel.ash`' >> $HOME/.bashrc
164
165       or by doing:
166
167         env_parallel --install
168

EXIT STATUS

170       Same as GNU parallel.
171

AUTHOR

173       When using GNU parallel for a publication please cite:
174
175       O. Tange (2011): GNU Parallel - The Command-Line Power Tool, ;login:
176       The USENIX Magazine, February 2011:42-47.
177
178       This helps funding further development; and it won't cost you a cent.
179       If you pay 10000 EUR you should feel free to use GNU Parallel without
180       citing.
181
182       Copyright (C) 2007-10-18 Ole Tange, http://ole.tange.dk
183
184       Copyright (C) 2008-2010 Ole Tange, http://ole.tange.dk
185
186       Copyright (C) 2010-2023 Ole Tange, http://ole.tange.dk and Free
187       Software Foundation, Inc.
188

LICENSE

190       This program is free software; you can redistribute it and/or modify it
191       under the terms of the GNU General Public License as published by the
192       Free Software Foundation; either version 3 of the License, or at your
193       option any later version.
194
195       This program is distributed in the hope that it will be useful, but
196       WITHOUT ANY WARRANTY; without even the implied warranty of
197       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
198       General Public License for more details.
199
200       You should have received a copy of the GNU General Public License along
201       with this program.  If not, see <http://www.gnu.org/licenses/>.
202
203   Documentation license I
204       Permission is granted to copy, distribute and/or modify this
205       documentation under the terms of the GNU Free Documentation License,
206       Version 1.3 or any later version published by the Free Software
207       Foundation; with no Invariant Sections, with no Front-Cover Texts, and
208       with no Back-Cover Texts.  A copy of the license is included in the
209       file LICENSES/GFDL-1.3-or-later.txt.
210
211   Documentation license II
212       You are free:
213
214       to Share to copy, distribute and transmit the work
215
216       to Remix to adapt the work
217
218       Under the following conditions:
219
220       Attribution
221                You must attribute the work in the manner specified by the
222                author or licensor (but not in any way that suggests that they
223                endorse you or your use of the work).
224
225       Share Alike
226                If you alter, transform, or build upon this work, you may
227                distribute the resulting work only under the same, similar or
228                a compatible license.
229
230       With the understanding that:
231
232       Waiver   Any of the above conditions can be waived if you get
233                permission from the copyright holder.
234
235       Public Domain
236                Where the work or any of its elements is in the public domain
237                under applicable law, that status is in no way affected by the
238                license.
239
240       Other Rights
241                In no way are any of the following rights affected by the
242                license:
243
244                • Your fair dealing or fair use rights, or other applicable
245                  copyright exceptions and limitations;
246
247                • The author's moral rights;
248
249                • Rights other persons may have either in the work itself or
250                  in how the work is used, such as publicity or privacy
251                  rights.
252
253       Notice   For any reuse or distribution, you must make clear to others
254                the license terms of this work.
255
256       A copy of the full license is included in the file as
257       LICENCES/CC-BY-SA-4.0.txt
258

DEPENDENCIES

260       parset uses GNU parallel.
261

SEE ALSO

263       parallel(1), env_parallel(1), bash(1).
264
265
266
26720230722                          2023-07-28                         PARSET(1)
Impressum