notegrep: "sf" parameter

This commit is contained in:
dmarakom6 2021-06-23 19:36:22 +03:00
parent 09de7c2a1c
commit 7873536b92
2 changed files with 19 additions and 0 deletions

View file

@ -164,6 +164,11 @@ function notegrep() {
export option=$1
. ~/.shellnotes/util/notegrep/cf.sh
;;
-sf | --show-files )
export regex=$2
export option=$1
. ~/.shellnotes/util/notegrep/sf.sh
;;
esac
return 0

14
util/notegrep/sf.sh Normal file
View file

@ -0,0 +1,14 @@
:<<'info'
shellnotes - sf.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
files="$(grep -rwl $regex $DEFAULT_PATH/* | wc -l)"
if [ $files -ge 1 ]; then
grep -rwl $regex $DEFAULT_PATH/*
else
echo "No matching files found."
fi