#!/bin/bash
if [ "$1" = "" ]; then
echo "Uage: focu.sh <filename>"
exit 1;
else
output=$1
fi
lines_added=0
clear_and_align() {
lines=`tput lines`
half=`echo $lines/2-1 | bc`
tput clear
for i in $(seq 1 $half);
do
echo
done
}
goodbye() {
clear_and_align
echo "W R I T I N G S E S S I O N T E R M I N A T E D."
echo
echo "$lines_added L I N E S A D D E D"
exit
}
trap goodbye SIGINT
while :
do
clear_and_align
read line
echo $line >> "$output"
((lines_added+=1))
done