shellnotes/util/notegrep/cf.sh
dmarakom6 e3f7e7414f Fix output bug
Fix -cf and -sf returning "No such file" or proceeding in normal grep mode
2021-06-28 13:42:57 +03:00

23 lines
565 B
Bash

:<<'info'
shellnotes - cf.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 -eq 1 ]; then
echo "Found $files matching file in $DEFAULT_PATH."
elif [ $files -gt 1 ]; then
echo "Found $files matching files in $DEFAULT_PATH."
echo -n "Show files?(Y/N): " && read show
case $show in
yes | y | Y | YES | Yes )
grep -rwl $regex $DEFAULT_PATH/*
;;
esac
else
echo "No matching files found."
fi