Interesting and entertaining Script that i found in ParadiseLinux which makes snowflakes fall indefinitely on our console.
The code in question is this:
[Code]#! / 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❄ \ 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
We save it in a file and give it any name, let's say snowing.sh. Then we give it execution permissions:
$ chmod +x nevando.sh
and we execute it in a terminal
$ ./nevando.sh
All that remains is to put some Christmas song in the background 😛
A little late is this, but hey
A little late for those from the northern hemisphere, but also, a little early for those from the southern hemisphere.