diff options
| author | marcellus <msimon_fr@hotmail.com> | 2024-02-02 22:13:34 +0100 |
|---|---|---|
| committer | marcellus <msimon_fr@hotmail.com> | 2024-02-02 22:13:34 +0100 |
| commit | 3ddbe04c5a8b01fe00221339dcfc5489b2b032db (patch) | |
| tree | 24abfc50f4a926ce22e047637617fbc5cd3eae67 /scripts/snowjob | |
| parent | 1b7402b9e0d623cab9284aada81fb5429cf662e7 (diff) | |
various: read the diff
Diffstat (limited to 'scripts/snowjob')
| -rwxr-xr-x | scripts/snowjob | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/snowjob b/scripts/snowjob new file mode 100755 index 0000000..6c98251 --- /dev/null +++ b/scripts/snowjob @@ -0,0 +1,40 @@ +#!/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[1;1H " ${lastflakes[$i]} $i + fi + fi + + printf "\033[%s;%sH\u274$[($RANDOM%6)+3]\033[1;1H" ${snowflakes[$i]} $i + + lastflakes[$i]=${snowflakes[$i]} + snowflakes[$i]=$((${snowflakes[$i]}+1)) +} + +while : +do + i=$(($RANDOM % $COLUMNS)) + + move_flake $i + + for x in "${!lastflakes[@]}" + do + move_flake "$x" + done + + sleep 0.1 +done
\ No newline at end of file |
