the_earnest/dotfiles
added findbook script
Commit 184c00b383a2 · The Earnest · 2026-11-20 12:35 +0000
Comments
No comments yet.
Diff
diff --git a/makelinks.sh b/makelinks.sh
--- a/makelinks.sh
+++ b/makelinks.sh
@@ -1,4 +1,8 @@
#!/bin/bash
+
ln -s ~/.dotfiles/bashrc ~/.bashrc
ln -s ~/.dotfiles/godirrc ~/.godirrc
ln -s ~/.dotfiles/vimrc ~/.vimrc
+
+mkdir -p ~/bin
+ln -s ./.dotfiles/scripts/findbook ~/bin/findbook
diff --git a/scripts/findbook b/scripts/findbook
new file mode 100755
--- /dev/null
+++ b/scripts/findbook
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+SD=~/storage/sdcard
+TMPFILE=$(mktemp)
+dir1="$SD/Books excluded/"
+dir2="$SD/Books/"
+dir3="$SD/Languages/"
+
+CMD='find "$dir1" "$dir2" "$dir3" -type f '
+for searchterm in "$@"
+do
+ CMD="$CMD -iname '*${searchterm}*' "
+ echo $CMD
+done
+eval "$CMD"| grep -v "\.MoonReader" >"$TMPFILE"
+
+#find "$dir1" "$dir2" "$dir3" -type f -iname '*'"$1"'*' | grep -v "\.MoonReader" >"$TMPFILE"
+
+# strip the path prefix
+# remove .MoonReader lines
+sed -i -e "s#.*$SD/##" -e "/\.MoonReader/d" "$TMPFILE"
+
+
+#-e '/.*\/\..*/d'
+grep -v '/\.' "$TMPFILE"
+rm "$TMPFILE"