aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <chaffinach+git@protonmail.ch>2022-01-05 16:46:37 +0000
committerMatthew Lemon <chaffinach+git@protonmail.ch>2022-01-05 16:46:37 +0000
commitb0d892ef73f47e1140d93c5cbea92fd6ea00a9cb (patch)
treec52628f3d53f439d9df99afd98873d73a5de3f45
parentc7533543afa7bab799dcb6764611e49edb683b0f (diff)
grepnote does not do case insensitive yet
-rwxr-xr-xgrepnote25
1 files changed, 25 insertions, 0 deletions
diff --git a/grepnote b/grepnote
new file mode 100755
index 0000000..f1732dc
--- /dev/null
+++ b/grepnote
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+NOTES=/home/$USER/Notes
+RG_BIN=/usr/bin/rg
+GREP=/usr/bin/grep
+CMD="$RG_BIN --heading -i"
+
+if [[ -z $1 ]]; then
+ echo "You must provide a file name as the argument to this command."
+ exit 1
+else
+ TARGET=$1
+fi
+
+# test for rg
+if ! [[ -x $RG_BIN ]]; then
+ CMD="$($GREP -n -H -r)"
+fi
+
+# rg --heading -i "joanna" ~/Notes/journal/
+echo $TARGET
+echo $NOTES
+$CMD $TARGET $NOTES
+
+