From 1ca23d7427d216737eb62160dcc60cdd6ca28673 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Tue, 19 Apr 2022 11:11:59 +0100 Subject: creating bsd-versions of bash scripts --- grepnote_openbsd | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 grepnote_openbsd (limited to 'grepnote_openbsd') 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 + + -- cgit v1.2.3