You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
807 B
Cheetah

# chezmoi:template:left-delimiter=#{{
#{{- /* vim: set filetype=bash: */ -}}
#{{ if .include_legacy -}}
12 years ago
#!/bin/bash
LINES=$(tput lines)
COLUMNS=$(tput cols)
declare -A snowflakes
declare -A lastflakes
clear
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[0;0H " "${lastflakes[$i]}" "$i"
12 years ago
fi
fi
printf "\033[%s;%sH❄\033[0;0H" "${snowflakes[$i]}" "$i"
12 years ago
lastflakes[$i]=${snowflakes[$i]}
snowflakes[$i]=$((${snowflakes[$i]}+1))
}
while :
do
i=$((RANDOM % COLUMNS))
12 years ago
move_flake $i
for x in "${!lastflakes[@]}"
do
move_flake "$x"
done
sleep 0.1
done
#{{- end }}