]> zdv2.bktei.com Git - BK-2020-03.git/commitdiff
feat(unitproc/find_erotica.sh):Accept multiple dirs
authorSteven Baltakatei Sandoval <baltakatei@gmail.com>
Thu, 20 Aug 2026 08:46:13 +0000 (08:46 +0000)
committerSteven Baltakatei Sandoval <baltakatei@gmail.com>
Thu, 20 Aug 2026 08:46:13 +0000 (08:46 +0000)
unitproc/find_erotica.sh

index 15020989b600698d02135a6790492a22d01be2f0..4b073b95a01e5a5752c4e9a734acbbe1e95efcec 100755 (executable)
@@ -2,7 +2,7 @@
 # Desc: Searches for erotic phrases in text files in specified working directory
 # Usage: find_erotica.sh [dir]
 # Depends: GNU Find utils, GNU Parallel 20210822, GNU Grep, GNU Coreutils 8.32, bc
 # Desc: Searches for erotic phrases in text files in specified working directory
 # Usage: find_erotica.sh [dir]
 # Depends: GNU Find utils, GNU Parallel 20210822, GNU Grep, GNU Coreutils 8.32, bc
-# Version: 0.3.0
+# Version: 0.4.0
 
 
 FIN_MAX=400;
 
 
 FIN_MAX=400;
@@ -282,10 +282,13 @@ find_phrase () {
     #printf "Found %d matching lines for phrases in %s.\n" "${#output[@]}" "$fin" 1>&2; # debug
 }; # find phrase
 main () {
     #printf "Found %d matching lines for phrases in %s.\n" "${#output[@]}" "$fin" 1>&2; # debug
 }; # find phrase
 main () {
-    din="$1";
-    if [[ ! -d "$din" ]]; then die "FATAL:Not a dir:${din}"; fi;
+    # Check args are dirs
+    local item;
+    for item in "$@"; do
+        if [[ ! -d "$item" ]]; then die "FATAL:Not a dir:${din}"; fi;
+    done;
 
 
-    find "$din" -type f -name "*.txt" | shuf | head -n "$FIN_MAX" | \
+    find "$@" -type f -name "*.txt" | shuf | head -n "$FIN_MAX" | \
         #parallel search_thread '{}' | less --RAW-CONTROL-CHARS -S;
         parallel search_thread '{}';
 };
         #parallel search_thread '{}' | less --RAW-CONTROL-CHARS -S;
         parallel search_thread '{}';
 };