git.y1.nz

typie

Minimal typing practice tool.
download: https://git.y1.nz/archives/typie.tar.gz
README | Files | Log | Refs | LICENSE

examples/learn.sh

      1 #!/bin/sh
      2 
      3 # Usage: learn.sh [LESSON_NUMBER]
      4 # Do specific lessons by number. 
      5 
      6 set -e
      7 
      8 LESSON_NUMBER=$1
      9 
     10 LESSONS="uh
     11 et
     12 on
     13 as
     14 id
     15 pg
     16 kb
     17 kx
     18 jm
     19 qw
     20 vz
     21 yf
     22 c.
     23 r,
     24 l?
     25 v;
     26 z-
     27 1234567890"
     28 
     29 get_lesson() {
     30 	echo "$LESSONS" | sed -n "${1}p"
     31 }
     32 
     33 if [ "$LESSON_NUMBER" = "" ]; then
     34 	echo "Usage: ./learn.sh [LESSON_NUMBER]"
     35 
     36 	NUMBERS=""
     37 	LESSON_COUNT=$(echo "$LESSONS" | wc -l)
     38 	for i in $(seq $LESSON_COUNT); do
     39 		CUR="$i[$(get_lesson "$i")]"
     40 		NUMBERS="$NUMBERS $CUR"
     41 	done
     42 	echo "LESSON_NUMBER: $NUMBERS" | fold
     43 	exit 1
     44 fi
     45 
     46 
     47 OLD_LETTERS=""
     48 for i in $(seq $(($LESSON_NUMBER-1))); do
     49 	CUR="$(get_lesson $i)"
     50 	OLD_LETTERS="$OLD_LETTERS$CUR"
     51 done
     52 NEW_LETTERS=$(get_lesson $LESSON_NUMBER)
     53 
     54 ./lesson.sh "$OLD_LETTERS" "$NEW_LETTERS"

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.