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