aboutsummaryrefslogtreecommitdiffstats
path: root/unix/snow.sh
blob: 57657d29a00054f2d0195e4ae6050bf9ecfc087f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
#
# Command line – Let it snow, Let it snow, Let it snow
# http://mebsd.com/coding-snipits/command-line-let-it-snow-let-it-snow-let-it-snow.html
# October 9, 2012
#

LINES=${LINES:-24}
COLUMNS=${COLUMNS:-90}

clear; \
while :; \
do \
echo $LINES $COLUMNS $(($RANDOM%$COLUMNS)); \
sleep 0.1; \
done | \
awk '{ \
         a[$3]=0; \
         for(x in a) {o=a[x]; \
                      a[x]=a[x]+1; \
                      printf "\033[%s;%sH ",o,x; \
                      printf "\033[%s;%sH*\033[0;0H",a[x],x; \
                     } \
     }'