aboutsummaryrefslogtreecommitdiffstats
path: root/unix/snow.sh
diff options
context:
space:
mode:
Diffstat (limited to 'unix/snow.sh')
-rwxr-xr-xunix/snow.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/unix/snow.sh b/unix/snow.sh
new file mode 100755
index 0000000..57657d2
--- /dev/null
+++ b/unix/snow.sh
@@ -0,0 +1,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; \
+ } \
+ }'