#!/bin/sh
trap '{ printf "\e[?12l\e[?25h" ; }' SIGTERM SIGKILL EXIT
if [ $# -ne "1" ]
then
echo "Uso: $0 loquesea.ANS"
exit 1
fi

if [ ! -f "$1" ]
then
echo "Fichero $1 no encontrado."
exit 1 
fi
trap '{ reset; }' EXIT SIGTERM SIGKILL
ANIMATION="$1"
SPEED='.005' # wait this time each line

# 1. Disable cursor
printf "\e[?25l"

# 2. Download, convert, display slow == play animation
cat $ANIMATION | \
    iconv -f cp437 -t utf-8  | \
    awk "{system(\"sleep $SPEED\");print}"

# 3. Enable cursor settings
printf "\e[?12l\e[?25h"


