#!/bin/sh song=$(mpc --format "[[%title% - ]%artist%]|[%file%]" current) len=$(echo "$song" | awk '{print length}') if [ "$len" -gt 40 ] then song=$(echo "$song" | head -c 38) echo "$song.." else echo "$song" fi