projects
/
BK-2020-03.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat(unitproc/isAudio):Add script to filter audio files from find results
[BK-2020-03.git]
/
unitproc
/
bkshuf
diff --git
a/unitproc/bkshuf
b/unitproc/bkshuf
index 4bf9f997ebe53fe16d68b538cf98214e457add5e..e41d725b9620c82b29b919120da0bbb4a0bef2bb 100644
(file)
--- a/
unitproc/bkshuf
+++ b/
unitproc/bkshuf
@@
-1,12
+1,15
@@
#!/usr/bin/env bash
# Desc: Mixes input lines while also preserving some neighbors
# Usage: cat file | bkshuf arg1
#!/usr/bin/env bash
# Desc: Mixes input lines while also preserving some neighbors
# Usage: cat file | bkshuf arg1
-# Version 0.
0
.1
+# Version 0.
1
.1
# Depends: bc 1.07.1, GNU Coreutils 8.32 (shuf)
# Input: var: arg1 initial lines to output
# Depends: bc 1.07.1, GNU Coreutils 8.32 (shuf)
# Input: var: arg1 initial lines to output
-BKSHUF_PARAM_LINEC=1000000;
-BKSHUF_PARAM_GSIZE=25 # lines per group for BKSHUF_PARAM_LINEC lines of input
+# Load env vars
+## For these numbers of lines of input...
+if [[ ! -v BKSHUF_PARAM_LINEC ]]; then BKSHUF_PARAM_LINEC=1000000; fi;
+## ... target this group size.
+if [[ ! -v BKSHUF_PARAM_GSIZE ]]; then BKSHUF_PARAM_GSIZE=25; fi;
yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
yell() { echo "$0: $*" >&2; } # print script path and all args to stderr
@@
-121,7
+124,12
@@
main() {
else
lc_out_max="$1"; # output line count
fi;
else
lc_out_max="$1"; # output line count
fi;
-
+
+ # Check env vars
+ if ! checkInt "$BKSHUF_PARAM_LINEC"; then
+ die "FATAL:Not an int:BKSHUF_PARAM_LINEC:$BKSHUF_PARAM_LINEC"; fi;
+ if ! checkInt "$BKSHUF_PARAM_GSIZE"; then
+ die "FATAL:Not an int:BKSHUF_PARAM_LINEC:$BKSHUF_PARAM_GSIZE"; fi;
# store input lines from stdin (like `shuf`)
while read -r line; do
# store input lines from stdin (like `shuf`)
while read -r line; do