feat(user/bk-copy-rand-music): Use env vars for bkshuf params
[BK-2020-03.git] / unitproc / bkshuf
index 8aaac9d30368cba6370e519e0be596e836fee1c6..e41d725b9620c82b29b919120da0bbb4a0bef2bb 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 # Desc: Mixes input lines while also preserving some neighbors
 # Usage: cat file | bkshuf arg1
-# Version 0.1.0
+# Version 0.1.1
 # Depends: bc 1.07.1, GNU Coreutils 8.32 (shuf)
 # Input: var: arg1  initial lines to output
 
@@ -124,7 +124,12 @@ main() {
     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