From e7996e5daed61d23ba8a583b979e17dcfbc29a8b Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Tue, 9 Nov 2021 11:26:22 +0100 Subject: [PATCH] bash: rgi verbessert --- .bash_functions | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.bash_functions b/.bash_functions index 13f0250..53114a5 100644 --- a/.bash_functions +++ b/.bash_functions @@ -69,4 +69,22 @@ function rgf { fi fi } +function rgi { + if [[ "$1" == "--help" ]]; then + echo "Finde alle Dateien die "\$1" im Inhalt haben." + echo "rgi" + echo "rgi " + else + if [ -z "$1" ]; then + echo "Suchbegriff fehlt..." + else + if [[ $(which rg) ]]; then + rg -i "$1" + else + echo "ripgrep ist nicht installiert... suche mit 'grep'" + grep -r -n -i "$1" . + fi + fi + fi +}