-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathworker.sh
30 lines (30 loc) · 875 Bytes
/
worker.sh
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
#!/bin/bash
## worker
## version 0.0.2 - work without xxd command
##################################################
worker() { { local infile ; infile="${1}" ; local -i concurrency ; concurrency="${2-1}" ; }
if-concurrency() {
test ! ${concurrency} -gt 1 || {
echo "-P ${concurrency}"
cecho yellow "concurrency: ${concurrency}"
}
}
## may depreciate
#hex-replace() {
# cat - \
# xxd -ps |
# sed 's/0a/00/g' |
# xxd -ps -r
#}
cecho green "doing work on $( cat ${infile} | wc -l ) jobs ..."
time {
cat ${infile} \
| xargs $( if-concurrency ) -i bash ${0} {}
}
cecho green "done doing work"
}
##################################################
## generated by create-stub2.sh v0.1.2
## on Wed, 17 Jul 2019 13:36:48 +0900
## see <https://github.com/temptemp3/sh2>
##################################################