1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/bin/sh set -xe root_dir="/home/qwd/music" test -f "${1}" test ! -d "${2}" echo "#EXTM3U" > "${2}" while read -r line; do echo "${line}" | sed "s@${root_dir}/@@g" >> "${2}" done < "${1}"