From 4910fb5df26fadcb7e59492c9d865db2f7b7a703 Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Tue, 9 Jan 2024 08:12:38 -0800 Subject: fix: bad find logic cause some dir not search; refactor: one liner to multi line --- grrc | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'grrc') 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" -- cgit v1.2.3-70-g09d2