elenapan/Scripts/scrollingtext.sh
elena e43cf1ccde updated scripts, added configs, new screenshot
Former-commit-id: 80e5a611d9
Former-commit-id: d6d963dd470140b7a955399ff22fec885ddace30
2017-08-29 02:28:24 +03:00

25 lines
No EOL
591 B
Bash
Executable file

# Scrolling text v2
LIMIT=12
SEPERATOR=" ~~~ "
SEPERATOR_LENGTH="$(echo ${#SEPERATOR})"
i=1
while :
do
# Get input and create the full string that will be used
INPUT="$@"
INPUT_LENGTH="$(echo ${#INPUT})"
LOOPTAIL="$(echo $INPUT | cut -c -$LIMIT)"
FULLSTRING="$(echo $INPUT | sed "s/$/$SEPERATOR/" | sed "s/$/$LOOPTAIL/" )"
# Show only LIMIT characters. Output scrolls due to incrementing i
echo -n $FULLSTRING | cut -c $i-$(($LIMIT+$i))
# If we have shown the full string, start over
if [ $i -eq $(($INPUT_LENGTH+$SEPERATOR_LENGTH)) ]; then
i=0
fi
i=$(($i+1))
sleep 1
done