aboutsummaryrefslogblamecommitdiffstats
path: root/grepnote
blob: b42dfe02d7131861dabfdb1a1315ede58d0af9c9 (plain) (tree)
1
2
3
4
5
6
7
8
9




                       
                                                                                                                                       

                    
                                                                          

          
               







                                           
                     

 
#!/bin/bash

NOTES=/home/$USER/Notes
RG_BIN=/usr/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