From 56eb26ce57d10d29d1f0b21fa49d253b389bf951 Mon Sep 17 00:00:00 2001 From: dmarakom6 Date: Sun, 27 Jun 2021 14:25:58 +0300 Subject: [PATCH] Fix notegrep output bug --- util/notegrep.sh | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/util/notegrep.sh b/util/notegrep.sh index 505c337..09e3b34 100644 --- a/util/notegrep.sh +++ b/util/notegrep.sh @@ -170,26 +170,24 @@ function notegrep() { . ~/.shellnotes/util/notegrep/sf.sh ;; esac - return 0 + + + if [ -z $notename ]; then + echo "Invalid input." + cd $DIR + return 0 + + elif [ -z $regex ]; then + echo "No pattern given." + cd $DIR + return 0 + fi + + + do_grep fi - if [ -z $notename ]; then - echo "Invalid input." - cd $DIR - return 0 - - elif [ -z $regex ]; then - echo "No pattern given." - cd $DIR - return 0 - fi - - - - - do_grep - unset GREP_OPTIONS unset -f check_params unset -f do_grep