-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmarquee.sh
39 lines (32 loc) · 867 Bytes
/
marquee.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
#
# https://unix.stackexchange.com/a/722000
function slice_loop () { ## grab a slice of a string, and if you go past the end loop back around
local str="$1"
local start=$2
local how_many=$3
local len=${#str};
local result="";
for ((i=0; i < how_many; i++))
do
local index=$(((start+i) % len)) ## Grab the index of the needed char (wrapping around if need be)
local char="${str:index:1}" ## Select the character at that index
local result="$result$char" ## Append to result
done
echo -n $result
}
msg=" .. esta noche rematamos el despliegue! sobre las 23:00 vuelvo .. ";
begin=0
echo
echo "twitch.tv/jartigag"
echo
echo
while :
do
slice=$(slice_loop "$msg" $begin 14);
echo -ne "\r";
echo -n $slice;
echo -ne " \r";
sleep 0.08;
((begin=begin+1));
done