aboutsummaryrefslogtreecommitdiffstats
path: root/grepnote_openbsd
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xgrepnote_openbsd23
1 files changed, 23 insertions, 0 deletions
diff --git a/grepnote_openbsd b/grepnote_openbsd
new file mode 100755
index 0000000..36cb8c6
--- /dev/null
+++ b/grepnote_openbsd
@@ -0,0 +1,23 @@
+#!/usr/local/bin/bash
+
+NOTES=/home/$USER/Notes
+RG_BIN=/usr/local/bin/rg
+GREP=/usr/bin/grep
+CMD="$RG_BIN --heading -w -i -g !"*fish-history*" -g !"*.html*" -g !"*apt-packages*" -g !"*.json" -g !"*-fish-history*" -g !"*backup*""
+
+if [[ -z $1 ]]; then
+ echo "You must provide a search term 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/
+$CMD "$TARGET" $NOTES
+
+