the_earnest/dotfiles
simplified code constructing -iname conditions in function f()
Commit c496a7652b88 · The Earnest · 2026-11-20 00:22 +0000
Comments
No comments yet.
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