#!/bin/bash playerctl --follow metadata --format '{{ title }}' | { while read -r nowplaying_title; do if [ ${#nowplaying_title} -ge 45 ];then echo "${nowplaying_title:0:40}…" else echo "${nowplaying_title}" fi # echo "${nowplaying_title}" | head -c 50; done }