Fix: no output for 20-line files

This commit is contained in:
dmarakom6 2021-05-04 20:44:47 +03:00
parent cc3584a5be
commit 5a6f1cd68e
2 changed files with 8 additions and 8 deletions

View file

@ -1,4 +1,4 @@
#!/bin/zsh
#The first line is the user's default shell found during installation process. #The first line is the user's default shell found during installation process.

View file

@ -33,12 +33,12 @@ Now, change the highlight color of grep by using an environment variable, GREP_C
An empty string or 0 resets all text styling and resets both colors to the defaults but An empty string or 0 resets all text styling and resets both colors to the defaults but
does not reset the font to the default. Some options/examples are: does not reset the font to the default. Some options/examples are:
┏━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━ ┏━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
### ┃ GNOME Terminal ┃ xterm ┃ non-GUI TTY ┃ ### ┃ GNOME Terminal ┃ xterm ┃ non-GUI TTY ┃
┡━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━ ┡━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
│ │ «reset style+colors» │ «reset style+colors» │ «reset style+colors» │ │ │ «reset style+colors» │ «reset style+colors» │ «reset style+colors» │
0 │ «reset style+colors» │ «reset style+colors» │ «reset style+colors» │ 0 │ «reset style+colors» │ «reset style+colors» │ «reset style+colors» │
├─────┼─────────────────────────┼─────────────────────────┼───── ├─────┼─────────────────────────┼─────────────────────────┼─────━━━━━━━━━━━━━━━━━━━
1 │ +bold, +brighter color │ +bold, +brighter color │ +brighter color, │ 1 │ +bold, +brighter color │ +bold, +brighter color │ +brighter color, │
│ │ │ │ -forced grey │ │ │ │ │ -forced grey │
2 │ +fainter color │ +fainter color │ +forced grey │ 2 │ +fainter color │ +fainter color │ +forced grey │
@ -51,7 +51,7 @@ does not reset the font to the default. Some options/examples are:
8 │ +invisible │ +invisible │ «no effect» │ 8 │ +invisible │ +invisible │ «no effect» │
│ │ │ ● underline appears │ │ │ │ │ ● underline appears │ │
9 │ +strikethrough │ +strikethrough │ «no effect» │ 9 │ +strikethrough │ +strikethrough │ «no effect» │
├────┼─────────────────────────────────────────────────────────── Source: https://askubuntu.com/questions/1042234/modifying-the-color-of-grep ├────┼───────────────────────────────────────────────────────────━━━━━━━━━━━━━━━━━ Source: https://askubuntu.com/questions/1042234/modifying-the-color-of-grep
21 │ -bold, -brighter color, │ +double underline │ -brighter color, │ 21 │ -bold, -brighter color, │ +double underline │ -brighter color, │
│ │ -fainter color ├ -forced grey │ │ │ │ -fainter color ├ -forced grey │ │
22 │ -bold, -brighter color, │ -bold, -brighter color, │ -brighter color, │ 22 │ -bold, -brighter color, │ -bold, -brighter color, │ -brighter color, │
@ -63,7 +63,7 @@ does not reset the font to the default. Some options/examples are:
27 │ -invert colors │ -invert colors │ -invert colors │ 27 │ -invert colors │ -invert colors │ -invert colors │
28 │ -invisible │ -invisible │ «no effect» │ 28 │ -invisible │ -invisible │ «no effect» │
29 │ -strikethrough │ -strikethrough │ «no effect» │ 29 │ -strikethrough │ -strikethrough │ «no effect» │
└─────┴─────────────────────────┴─────────────────────────┴────── └─────┴─────────────────────────┴─────────────────────────┴──────━━━━━━━━━━━━━━━━━━
In this example, the matching regex is going to be displayed as bold yellow (in most terminals). In this example, the matching regex is going to be displayed as bold yellow (in most terminals).
@ -93,8 +93,8 @@ comment
function notegrep() { function notegrep() {
if [ $# -eq 0 ]; then if [ $# -eq 0 ]; then
echo -n "Enter regex: " && read regex
echo -n "Enter note name: " && read notename echo -n "Enter note name: " && read notename
echo -n "Enter regex: " && read regex
else else
notename=$2 notename=$2
regex=$1 regex=$1
@ -115,7 +115,7 @@ function notegrep() {
if [ $out -gt 20 ]; then if [ $out -gt 20 ]; then
grep -i $regex $notename | less grep -i $regex $notename | less
elif [ $out -lt 20 ]; then elif [ $out -le 20 ]; then
grep -i $regex $notename grep -i $regex $notename
else else
return 0 return 0