the_earnest/dotfiles
fixed findbook to handle no-argument case
Commit 61b7ee13ff7c · The Earnest · 2026-11-20 12:46 +0000
Comments
No comments yet.
Diff
diff --git a/godirrc b/godirrc
--- a/godirrc
+++ b/godirrc
@@ -1,6 +1,4 @@
MAXDEPTH=2
PRUNE_EXPR="\
--path './Android' -prune -o \
--regex '.*/\.git*' -prune -o \
--regex '.*/\.hg*' -prune -o \
+-type d -name '.hg' -prune -o \
"
diff --git a/scripts/findbook b/scripts/findbook
--- a/scripts/findbook
+++ b/scripts/findbook
@@ -1,5 +1,7 @@
#!/bin/bash
+THIS=$(basename $0)
+
SD=~/storage/sdcard
TMPFILE=$(mktemp)
dir1="$SD/Books excluded/"
@@ -7,11 +9,15 @@
dir3="$SD/Languages/"
CMD='find "$dir1" "$dir2" "$dir3" -type f '
-for searchterm in "$@"
-do
- CMD="$CMD -iname '*${searchterm}*' "
- echo $CMD
-done
+if [[ $# -gt 0 ]]; then
+ for searchterm in "$@"
+ do
+ CMD="$CMD -iname '*${searchterm}*' "
+ echo $CMD
+ done
+else
+ echo "$THIS: no arguments given, searching for all books"
+fi
eval "$CMD"| grep -v "\.MoonReader" >"$TMPFILE"
#find "$dir1" "$dir2" "$dir3" -type f -iname '*'"$1"'*' | grep -v "\.MoonReader" >"$TMPFILE"