aboutsummaryrefslogtreecommitdiffstats
path: root/grepnote_openbsd
diff options
context:
space:
mode:
authorMatthew Lemon <chaffinach+git@protonmail.ch>2022-04-19 11:11:59 +0100
committerMatthew Lemon <chaffinach+git@protonmail.ch>2022-04-19 11:11:59 +0100
commit1ca23d7427d216737eb62160dcc60cdd6ca28673 (patch)
treed5d8fd9fde24eddfbf803728f4d2266975790707 /grepnote_openbsd
parent401b29df7d137747b289e0463e329aa64cb074c2 (diff)
creating bsd-versions of bash scripts
Diffstat (limited to 'grepnote_openbsd')
-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
+
+