fvwm/scripts/FvwmMPD/parseplaylist.sh
raw| 1 | #!/usr/bin/env bash |
| 2 | #mpc playlist | while read line; do |
| 3 | # if [[ -n $(echo ${line}|grep "`mpc|head -n 1`") ]]; then |
| 4 | # echo ${line}| grep "`mpc|head -n 1`"|tr '#' '>' |
| 5 | # else |
| 6 | # echo ${line} |
| 7 | # fi |
| 8 | #done |
| 9 | |
| 10 | #thanks to axxo for providing something more streamlined than the evil convoluted code I came up with;) |
| 11 | current=$(mpc | head -n 1) |
| 12 | mpc playlist | while read line; do |
| 13 | if [[ "${line#* }" == "${current}" ]]; then |
| 14 | echo ${line/\#/>} |
| 15 | else |
| 16 | echo ${line} |
| 17 | fi |
| 18 | done |