diff --git a/util/notegrep/cl.sh b/util/notegrep/cl.sh index 6db29ca..06b3b5d 100644 --- a/util/notegrep/cl.sh +++ b/util/notegrep/cl.sh @@ -5,12 +5,26 @@ Released under the "All rights reserved" category. See the RIGHTS.txt file in /docs/github/ for its full text. info -out="$(grep $regex $DEFAULT_PATH/$notename | wc -l)" +if [ -f $DEFAULT_PATH/$notename ]; then + + out="$(grep $regex $DEFAULT_PATH/$notename | wc -l)" + + if [ $out -eq 1 ]; then + echo "Compressed $out line of grep output." + elif [ $out -gt 1 ]; then + echo "Compressed $out lines of grep output." + echo -n "Show lines?(Y/N): " && read show + case $show in + yes | y | Y | YES | Yes ) + grep -n $regex $DEFAULT_PATH/$notename + ;; + esac + else + echo "No matching lines found." + fi -if [ $out -eq 1 ]; then - echo "Compressed $out line of grep output." -elif [ $out -gt 1 ]; then - echo "Compressed $out lines of grep output." else - echo "No matching files found." -fi + echo "No such file." + return 0 + +fi \ No newline at end of file