#! /bin/bash # Width of display width=10 # Delay (in seconds) between frames delay=1 # Number of cursor positions to scroll in each frame speed=2 start=0 bounce=$speed while true; do # get the song song=$(audtool current-song) # Clear to beginning of line tput el1 # Go to beginning of line tput hpa 0 # Print $width characters starting at $start (no newline) printf "%s" "${song:start:width}" # Advance the window let start+=bounce if ((start+width >= ${#song})); then # at or past the end # Go to the end of the song let start=${#song}-width # Moving backwards let bounce=-speed elif ((start <= 0)); then # at the beginning # Go to the beginning let start=0 # Moving forwards let bounce=speed fi sleep "$delay" done