File: endless.sh

package info (click to toggle)
node-xterm 5.3.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,372 kB
  • sloc: javascript: 2,388; sh: 344; python: 59; makefile: 15
file content (22 lines) | stat: -rwxr-xr-x 435 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

# sixel endless mode
# Should print an endless sine curve, abort with Ctrl-C.

period=200
amplitude=50

sixels=(@\$ A\$ C\$ G\$ O\$ _\$-)
pi=$(echo "scale=10; 4*a(1)" | bc -l)
run=true
trap run=false INT

echo -ne "\x1bP0;0;0q\"1;1#1;2;100;0;0#1"
y=0
while $run
do
  x=$(echo "s(2*${pi}*${y}/${period})*${amplitude}+2*${amplitude}+0.5" | bc -l)
  echo -ne "!${x%%.*}?${sixels[$((y%6))]}"
  (( y++ ))
done
echo -e "\x1b\\"