the_earnest/dotfiles

simplified code constructing -iname conditions in function f()

Commit c496a7652b88 · The Earnest · 2026-11-20 00:22 +0000

Changeset
c496a7652b88f759cc734925bc3f30ead3ffc367

View source at this commit

Comments

No comments yet.

Log in to comment

Diff

diff --git a/godir/godir.bash b/godir/godir.bash
--- a/godir/godir.bash
+++ b/godir/godir.bash
@@ -9,10 +9,11 @@
 	FINDCMD+="-path '*/.MoonReader' "
 	FINDCMD+=" \) -prune -o"
 
+	# add an -iname condition for every arg; this is better than
+	# combining them all into *$1*$2*$3* etc., because that would
+	# only match for the specific order in which the args are given
 	for i in "$@"; do
-		FINDCMD+=" -iname '"
-		FINDCMD+='*'"$i"'*'
-		FINDCMD+=\'
+		FINDCMD+=" -iname '*$i*'"
 	done
 	FINDCMD+=" -print"
 	echo FINDCMD=$FINDCMD