notegrep: Check for invalid input including parameters

This commit is contained in:
dmarakom6 2021-07-01 18:23:04 +03:00
parent 6540ec4e49
commit 54276bc1d2

View file

@ -132,6 +132,9 @@ function notegrep() {
;;
-sl | --show-lines )
. ~/.shellnotes/util/notegrep/sl.sh
;;
-ws | --without-string )
. ~/.shellnotes/util/notegrep/ws.sh
;;
*)
echo "Invalid parameter. Proceeding in normal grep mode."
@ -171,6 +174,9 @@ function notegrep() {
export option=$1
. ~/.shellnotes/util/notegrep/sf.sh
;;
-sc | --split-char | -cl | --count-lines | -sf | --show-lines | -ws | --without-string)
echo "Invalid use of parameter '$regex'.\nUsage:\nnotegrep [PATTERN] file...\nnotegrep [OPTION] [PATTERN] file...\nnotegrep [OPTION] file...\nnotegrep [OPTION] [PATTERN]"
;;
*)
if [ -z $notename ]; then
echo "Invalid input."