Fix $i < 0 Signed-off-by: Anirudh Oppiliappan <x@icyphox.sh>
Anirudh Oppiliappan x@icyphox.sh
Sun, 02 Feb 2020 19:39:58 +0530
1 files changed,
8 insertions(+),
3 deletions(-)
jump to
M
shlide
→
shlide
@@ -66,10 +66,15 @@ slides_dir="${1:-./}"
slides=("$slides_dir"/[0-9]*.txt) i=0 while true; do - if [ "$i" -gt "$((${#slides[@]} - 1))" ]; then + + # Exit after last slide. + [[ "$i" -gt "$((${#slides[@]} - 1))" ]] && { printf '\e[?25h' - exit; - fi + exit + } + + # Don't go below 0. + [[ "$i" -lt 0 ]] && i=0 # Navigate on j/k/n/p and quit on q. display "$(<${slides[$i]})" "${slides[$i]}"