summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Pan <gky44px1999@gmail.com>2024-01-09 08:12:38 -0800
committerXiao Pan <gky44px1999@gmail.com>2024-01-09 08:12:38 -0800
commit4910fb5df26fadcb7e59492c9d865db2f7b7a703 (patch)
treef0686fe2c46caa21508cfec02a45fc14e7cc809d
parent368c1b9352c09419b82c468b381f3ecc27fd2195 (diff)
fix: bad find logic cause some dir not search; refactor: one liner to multi line
-rwxr-xr-xgrrc18
1 files changed, 17 insertions, 1 deletions
diff --git a/grrc b/grrc
index 66a7200..64bd697 100755
--- a/grrc
+++ b/grrc
@@ -1,4 +1,20 @@
#!/bin/sh
# GRep -R Code
-[ "$1" ] && find "$HOME/archive/programs/public_archive_codes" "$HOME/archive/programs/private_archive_codes" "$HOME/archive/programs/me106_proj_fall2021" "$HOME/archive/programs/car_job/av_dev" "$HOME/archive/programs/VisualDimension" "$XDG_DOCUMENTS_DIR/notes" -mindepth 1 -maxdepth 1 -path "*/\.git" -prune -o -type d -print0 2>/dev/null | xargs -0 grep -s --color=always -iIR "$@" "$HOME/.local/bin" "$HOME/.bashrc" "$HOME/.profile" "$HOME/.xinitrc" "$HOME/programs/suckless/dwm_fly/config.def.h" "$XDG_CONFIG_HOME/nsxiv/exec/key-handler" | "$PAGER"
+# logic: no descend, in this dir, if a dir name .git; then true and do nothing; else if a file name LICENSE; then true and do nothing; else print
+[ "$1" ] && find "$HOME/programs/fsh" \
+ "$HOME/archive/programs/public_archive_codes" \
+ "$HOME/archive/programs/private_archive_codes" \
+ "$HOME/archive/programs/me106_proj_fall2021" \
+ "$HOME/archive/programs/car_job/av_dev" \
+ "$HOME/archive/programs/VisualDimension" \
+ "$XDG_DOCUMENTS_DIR/notes" \
+ -mindepth 1 -maxdepth 1 -type d -name '.git' -o -type f -name 'LICENSE' -o -print0 \
+ | xargs -0 grep -s --color=always -iIR "$@" \
+ "$HOME/.local/bin" \
+ "$HOME/.bashrc" \
+ "$HOME/.profile" \
+ "$HOME/.xinitrc" \
+ "$HOME/programs/suckless/dwm_fly/config.def.h" \
+ "$XDG_CONFIG_HOME/nsxiv/exec/key-handler" \
+ | "$PAGER"