File: parseplaylist.sh

package info (click to toggle)
fvwm-crystal 3.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 19,748 kB
  • ctags: 793
  • sloc: sh: 2,815; cs: 880; python: 875; makefile: 212
file content (18 lines) | stat: -rwxr-xr-x 490 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env bash
#mpc playlist | while read line; do
#    if [[ -n $(echo ${line}|grep "`mpc|head -n 1`") ]]; then
#	echo ${line}| grep "`mpc|head -n 1`"|tr '#' '>'
#    else
#	echo ${line}
#    fi
#done

#thanks to axxo for providing something more streamlined than the evil convoluted code I came up with;)
current=$(mpc | head -n 1)
mpc playlist | while read line; do
    if [[ "${line#* }" == "${current}" ]]; then
        echo ${line/\#/>}
    else
        echo ${line}
    fi
done