#!/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