Created
May 9, 2021 18:10
-
-
Save arai-ta/8a95c1a7a81bb2eaf204552969e434f4 to your computer and use it in GitHub Desktop.
新しいキーボードでコマンドの練習をするためのスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
TMPFILE=/tmp/`basename $0`.tmp | |
if [ $# = 0 ] | |
then | |
echo "Usage: `basename $0` " '$HISTFILE' | |
exit 1 | |
fi | |
export LANG=C | |
cat ${1:?} | sort | uniq -c | sort -k1r | awk '$1 >= 10{sub(/^ *[0-9]+ +/,"");sub(/ +$/,"");print}' > $TMPFILE | |
echo "Let's type your frequently used command. (@ to skip)" | |
IFS=$'\n' | |
for cmd in `cat $TMPFILE` | |
do | |
while : | |
do | |
echo "[ $cmd ]" | |
printf ">>> " | |
read TYPE | |
if [ "$TYPE" = "$cmd" ] | |
then | |
echo "OK, go next" | |
break | |
elif [ "$TYPE" = "@" ] | |
then | |
echo "Skipping..." | |
break | |
else | |
echo "Poor! try again!" | |
fi | |
done | |
done | |
rm $TMPFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment