-
Notifications
You must be signed in to change notification settings - Fork 0
/
parmap.1
84 lines (84 loc) · 2.49 KB
/
parmap.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
.\" Automatically generated by Pandoc 2.9.2.1
.\"
.TH "PARMAP" "1" "July 2020" "" ""
.hy
.SH NAME
.PP
parmap - parallelized execution of a shell command
.SH SYNOPSIS
.PP
\f[B]parmap\f[R] [option]\&... \f[I]variable\f[R] \f[I]command\f[R]
.SH DESCRIPTION
.PP
\f[B]parmap\f[R] reads arguments delimited by whitespace characters from
standard input and invokes \f[I]command\f[R] in parallel for each
argument.
For each invocation, \f[I]variable\f[R] is set to the corresponding
parsed argument and made available to \f[I]command\f[R] as an exported
environment variable.
.PP
\f[I]command\f[R] should consist of a single quoted string to prevent
shell expansions before execution.
When invoked by \f[B]parmap\f[R] it will be interpreted by
\f[B]/bin/sh\f[R] and hence should conform to valid POSIX shell syntax.
.PP
Delimiters for arguments read from standard input can be escaped using
either a backslash or single/double quotes and can be changed with the
commandline option \f[B]-d\f[R].
.PP
Processing continues for each argument until one of three conditions:
.IP \[bu] 2
End of input
.IP \[bu] 2
A \f[I]command\f[R] invocation exits with a status of 255
.IP \[bu] 2
A \f[I]command\f[R] invocation is terminated by a signal
.SH OPTIONS
.TP
-d, --delimiter \f[I]delim\f[R]
Delimiter(s) for parsing standard input.
A delimiter must be a 7-bit ascii character and cannot be the null byte.
Multiple characters will be interpreted as separate delimiters.
The default is whitespace characters.
.TP
-h, --help
Print help message and exit.
.TP
-m, --max-jobs \f[I]number\f[R]
Maximum number of child processes to run in parallel.
If unspecified or set to less than or equal to zero, the default is the
available number of CPU cores as determined by
\f[C]_SC_NPROCESSORS_ONLN\f[R] (see \f[B]sysconf\f[R](3)).
.TP
-v, --version
Print version number and exit.
.SH EXIT STATUS
.PP
If \f[C]parmap\f[R] encounters an internal error or if any of the child
processes return with a non-zero exit status or are terminated by a
signal, then \f[C]parmap\f[R] will exit with status 1.
Otherwise, the exit status will be 0 on success.
.SH EXAMPLES
.PP
Simple example using default options:
.IP
.nf
\f[C]
# Output order may vary
$ echo 1 2 3 4 | parmap x \[aq]echo number: $x\[aq]
\f[R]
.fi
.PP
If using \f[B]zsh\f[R], spaces in filenames can be escaped with quotes
by using a glob modifier.
For example:
.IP
.nf
\f[C]
$ touch \[dq]example file.txt\[dq]
$ print -r *(:q) | parmap f \[aq]echo file: $f\[aq]
\f[R]
.fi
.SH SEE ALSO
.PP
\f[B]find\f[R](1), \f[B]xargs\f[R](1)