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] (beta testing)
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.
28

OPTIONS

30       Same as GNU parallel, but they are put after the destination variable.
31

SUPPORTED SHELLS

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

EXIT STATUS

153       Same as GNU parallel.
154

AUTHOR

156       When using GNU parallel for a publication please cite:
157
158       O. Tange (2011): GNU Parallel - The Command-Line Power Tool, ;login:
159       The USENIX Magazine, February 2011:42-47.
160
161       This helps funding further development; and it won't cost you a cent.
162       If you pay 10000 EUR you should feel free to use GNU Parallel without
163       citing.
164
165       Copyright (C) 2007-10-18 Ole Tange, http://ole.tange.dk
166
167       Copyright (C) 2008,2009,2010 Ole Tange, http://ole.tange.dk
168
169       Copyright (C) 2010,2011,2012,2013,2014,2015,2016,2017,2018 Ole Tange,
170       http://ole.tange.dk and Free Software Foundation, Inc.
171

LICENSE

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

DEPENDENCIES

244       parset uses GNU parallel.
245

SEE ALSO

247       parallel(1), env_parallel(1), bash(1).
248
249
250
25120180122                          2018-02-05                         PARSET(1)
Impressum