Permalink
Browse files

windows: just like the OS

  • Loading branch information...
1 parent dc9ed00 commit e794325865fff524d7bd37af3c49bd2bbd7d7b7b @falconindy committed Apr 11, 2011
Showing with 36 additions and 0 deletions.
  1. +36 −0 windows
View
36 windows
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+#
+# a useless progress bar, windows style. doesn't tell you anything except that
+# this particular process hasn't (yet) crashed.
+#
+
+declare bc1='-' # "filled" progress
+declare bc2='-' # "unfilled" progress
+declare pulser='<│││>' # windows is awesome
+declare -i bw=40 # bar width
+declare -i pw=${#pulser} # pulser width
+st='.02s' # sleep time
+
+printbar() {
+ # leading visible bar
+ printf '\e[1;35m%*s\e[0m' "$1" | tr ' ' "$bc1"
+
+ # pulser
+ printf '\e[1;34m%s\e[0m' "$pulser"
+
+ # trailing visible bar
+ printf '\e[1;35m%*s\e[0m\r' "$(( bw - pw - $1 ))" | tr ' ' "$bc2"
+
+ sleep $st
+}
+
+while true; do
+ for (( i = 0; i < bw-pw; i++ )); do
+ printbar $i
+ done
+ for (( i = bw-pw; i > 0; i--)); do
+ printbar $i
+ done
+done
+

0 comments on commit e794325

Please sign in to comment.