Last active
February 15, 2019 11:52
-
-
Save danyalette/314e47a458506868439e308e1d9e4e09 to your computer and use it in GitHub Desktop.
bash function to print an ascii animation. takes a directory as an argument. prints the contents of each file in the directory, in sequence.
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 | |
# hash bang bin bash! | |
function ascii_anim() { | |
if [[ $# -eq 0 ]] ; then | |
echo 'Please specify a directory.' | |
return | |
fi | |
DIR=$1 | |
SLEEP=0.1; | |
TLINES=$(wc -l < $(find $DIR -type f | head -n 1)) | |
FILES=$DIR/* | |
for f in $FILES | |
do | |
tput cub $COLUMNS | |
cat $f | |
sleep $SLEEP | |
tput cuu $TLINES | |
done | |
tput cud $TLINES | |
echo "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The frames are as follows:
~/ascii_danya/frame1.txt
~/ascii_danya/frame2.txt
~/ascii_danya/frame3.txt
~/ascii_danya/frame4.txt
~/ascii_danya/frame5.txt