Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # This would be handy as a script to
- # produce variable load for testing
- trap "tput cvvis" EXIT
- # dash 0.5.5 at least doesn't support \x so we use /usr/bin/
- col_base="$(/usr/bin/printf '\x1b')[38;5;"
- for i in 229 228 227 226 220 184 178 202 196 160; do
- hlb="$hlb$col_base${i}m▣
- "
- done
- rsleep() {
- printf ".1\n.05\n.02\n.01\n" | shuf | tail -n1
- }
- tput civis
- col=$(tput bold; tput setaf 3)
- nc=$(tput sgr0)
- count=0
- max=10
- inc=1
- sleep=.1
- while true; do
- left=$(($max-$count))
- hl=$(printf "$hlb" | head -n$count | tr -d '\n')
- nl=$(yes □ 2>/dev/null | head -n$left | tr -d '\n')
- printf "\r$hl$nc$nl"
- sleep $sleep
- count=$(($count+$inc))
- [ "$count" -gt $max ] && { count=$max; inc=-1; sleep=$(rsleep); }
- [ "$count" -lt 0 ] && { count=0; inc=1; sleep=$(rsleep); }
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement