#!/bin/bash if [ "$1" != "-r-e-i-n-i-" ] then time $0 -r-e-i-n-i- exit fi LINES=$(tput lines) COLUMNS=$(tput cols) declare -A snowflakes declare -A lastflakes clear ab=0 function move_flake() { i="$1" if [ "${snowflakes[$i]}" = "" ] || [ "${snowflakes[$i]}" = "$LINES" ]; then snowflakes[$i]=0 else if [ "${lastflakes[$i]}" != "" ]; then printf "\033[%s;%sH \033[1;1H " ${lastflakes[$i]} $i fi fi ac=`echo "scale=0;20-($proz/5)"|bc -l` if [ $ac -gt $ab ] then ab=$ac space="$space"" " fi echo -e "\033[1d\033[31;7m \033[0m" echo -e "\033[32;7m\033[1d$space\033[22G\033[0m"$proz"% bis zu Animationsende " printf "\033[%s;%sH\033[3"$fa"mM\033[3"$fb"mf\033[3"$fc"mg \033[3"$fd"mR\033[3"$fe"me\033[3"$ff"mi\033[3"$fa"mn\033[3"$fb"mi\033[1;1H" ${snowflakes[$i]} $i lastflakes[$i]=${snowflakes[$i]} snowflakes[$i]=$((${snowflakes[$i]}+1)) } ti=0 while : do ti=`expr $ti + 1` proz=`echo "scale=0;100-(100*$ti/300)"|bc -l` if [ "$ti" -eq 300 ] then clear echo -e "\033[31mM\033[32mf\033[33mg \033[31mR\033[34me\033[35mi\033[36mn\033[31mi\033[0m" echo "Preformence" echo "Speed at`stty -a |head -n1|cut -f2-3 -d";"`" exit fi while : do fa=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c1` if [ "$fa" -le 6 ] then break fi done while : do fb=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c1` if [ "$fb" -le 6 ] then break fi done while : do fc=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c1` if [ "$fc" -le 6 ] then break fi done while : do fd=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c1` if [ "$fd" -le 6 ] then break fi done while : do fe=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c1` if [ "$fe" -le 6 ] then break fi done while : do ff=`dd if=/dev/urandom count=1 2> /dev/null | cksum | cut -c1` if [ "$ff" -le 6 ] then break fi done i=$(($RANDOM % $COLUMNS - $fa)) move_flake $i for x in "${!lastflakes[@]}" do move_flake "$x" done sleep 0.1 done