#!/usr/bin/env bash # # Select and play a song from the current playlist (using fzf) # set -e song=$(mpc -f "%position%) %artist% - %title%" playlist) song_index=$(fzf --query="$1" --select-1 --exit-0 --prompt='play > ' <<<"$song" | sed -n 's/^\([0-9]\+\)).*/\1/p') [[ -n $song_index ]] && mpc -q play "$song_index"