Last active
September 25, 2015 03:30
-
-
Save ianyon/e707f71d67ffacfcdd07 to your computer and use it in GitHub Desktop.
Function for ".bashrc" that works like HackerTyper
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/bash | |
########################################################################### | |
# Prints source code in screen when pressing any key | |
# Arguments: | |
# $1: Extension of the files, without "." | |
# $2 (optional): Number of characters to print with each keystroke. | |
# Default 10 | |
# $3 (optional): Filename or path of files to print | |
########################################################################### | |
hackertyper () { | |
lines=10 | |
if [ "$2" ] | |
then | |
lines=$2 | |
fi | |
filename=. | |
if [ "$3" ] | |
then | |
filename=$3 | |
fi | |
EXT="."$1; | |
for F in $(find $filename -iname "*$EXT" -nowarn -readable 2> /dev/null) | |
do | |
cat $F | \ | |
while IFS= read -rN $lines C | |
do | |
read -s -n 1 <&1 | |
echo -n "$C" | |
done | |
echo | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment