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 and made into an array.
25
26       If variablename contains multiple names separated by ',' or space, the
27       names will be the destination variables. The number of names must be at
28       least the number of jobs - otherwise some tmp files will not be cleaned
29       up.
30

OPTIONS

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

SUPPORTED SHELLS

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

EXIT STATUS

163       Same as GNU parallel.
164

AUTHOR

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

LICENSE

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

DEPENDENCIES

252       parset uses GNU parallel.
253

SEE ALSO

255       parallel(1), env_parallel(1), bash(1).
256
257
258
25920200122                          2020-01-27                         PARSET(1)
Impressum