ws: View large notes with less

This commit is contained in:
dmarakom6 2021-07-01 17:55:58 +03:00
parent 7670e463c7
commit c3eaa5bc53

View file

@ -5,13 +5,24 @@ Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text. in /docs/github/ for its full text.
info info
grepv() {grep -v $regex $DEFAULT_PATH/$notename} #the command run when input is valid grepv() { #the command run when input is valid
if [ $(grep -v $regex $DEFAULT_PATH/$notename | wc -l) -ge 20 ]; then
grep -v $regex $DEFAULT_PATH/$notename | less
else
grep -v $regex $DEFAULT_PATH/$notename
fi
}
nomatch() { nomatch() {
echo -n "There are no matches.\nView note anyway?(Y/N): " && read view echo -n "There are no matches.\nView note anyway?(Y/N): " && read view
case $view in case $view in
y | Y | yes | YES | Yes ) y | Y | yes | YES | Yes )
if [ $(cat $DEFAULT_PATH/$notename | wc -l) -ge 20 ]; then
less $DEFAULT_PATH/$notename
else
cat $DEFAULT_PATH/$notename cat $DEFAULT_PATH/$notename
fi
return 0 return 0
;; ;;
*) *)