Skip to content

Instantly share code, notes, and snippets.

@lon9
Created November 17, 2015 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lon9/2a2c203424968483fed7 to your computer and use it in GitHub Desktop.
Save lon9/2a2c203424968483fed7 to your computer and use it in GitHub Desktop.
Streaming AA
#!/bin/bash
CMD_NAME=`basename $0`
SPACE=`tput cols`
FILE_NAME=
if [ $# -ne 1 ]; then
echo "USAGE: $CMD_NAME file_name"
exit 1
fi
trap 'tput smam; exit 1' 1 2 3 15
FILE_NAME=$1
while [ $SPACE -gt 0 ];
do
while IFS='' read LINE
do
[[ $SPACE > 0 ]] && printf "%${SPACE}s" ' '
tput rmam; printf "%s\n" "$LINE"
done < $FILE_NAME
SPACE=$(( SPACE - 1 ))
sleep 0.02
if [ $SPACE -gt 0 ]; then
clear
fi
done
tput smam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment