Compare Pastes
Differences between the pastes
#130695 (27.12.2019 11:16)
and
#245674 (30.12.2021 07:19).
1 | #!/bin/bash | |
2 | trap "tput reset; tput cnorm; exit" 2 | |
3 | clear | |
4 | tput civis | |
5 | lin=2 | |
6 | col=$(($(tput cols) / 2)) | |
7 | c=$((col-1)) | |
8 | est=$((c-2)) | |
9 | color=0 | |
10 | tput setaf 2; tput bold | |
11 | ||
12 | # Tree | |
13 | for ((i=1; i<20; i+=2)) | |
14 | { | |
15 | tput cup $lin $col | |
16 | for ((j=1; j<=i; j++)) | |
17 | { | |
18 | echo -n \* | |
19 | } | |
20 | let lin++ | |
21 | let col-- | |
22 | } | |
23 | ||
24 | tput sgr0; tput setaf 3 | |
25 | ||
26 | # Trunk | |
27 | for ((i=1; i<=2; i++)) | |
28 | { | |
29 | tput cup $((lin++)) $c | |
30 | echo 'mWm' | |
31 | } | |
32 | new_year=$(date +'%Y') | |
33 | let new_year++ | |
34 | tput setaf 1; tput bold | |
35 | tput cup $lin $((c - 6)); echo MERRY CHRISTMAS | |
36 | tput cup $((lin + 1)) $((c - 10)); echo And lots of CODE in $new_year | |
37 | let c++ | |
38 | k=1 | |
39 | ||
40 | # Lights and decorations | |
41 | while true; do | |
42 | for ((i=1; i<=35; i++)) { | |
43 | # Turn off the lights | |
44 | [ $k -gt 1 ] && { | |
45 | tput setaf 2; tput bold | |
46 | tput cup ${line[$[k-1]$i]} ${column[$[k-1]$i]}; echo \* | |
47 | unset line[$[k-1]$i]; unset column[$[k-1]$i] # Array cleanup | |
48 | } | |
49 | ||
50 | li=$((RANDOM % 9 + 3)) | |
51 | start=$((c-li+2)) | |
52 | co=$((RANDOM % (li-2) * 2 + 1 + start)) | |
53 | tput setaf $color; tput bold # Switch colors | |
54 | tput cup $li $co | |
55 | echo o | |
56 | line[$k$i]=$li | |
57 | column[$k$i]=$co | |
58 | color=$(((color+1)%8)) | |
59 | # Flashing text | |
60 | sh=1 | |
61 | for l in C O D E | |
62 | do | |
63 | tput cup $((lin+1)) $((c+sh)) | |
64 | echo $l | |
65 | let sh++ | |
66 | sleep 0.01 | |
67 | done | |
68 | } | |
69 | k=$((k % 2 + 1)) |