Frankly, I have no idea why this does not work:
Code:
#!/bin/bash
img=/media/Music/`mpc --format [%file%] | head -1 | tail -1 | sed -e 's/\/[^/]*\..*$//' -e 's/ /\\\ /g' -e "s/'/\\\'/g"`
echo $img/cover.jpg
sel=/home/jswift/ipu.png
if [ -f $img/cover.jpg ]
then
sel=$img/cover.jpg
fi
if [ -f $img/cover.png ]
then
sel=$img/cover.png
fi
if [ -f $img/cover.gif ]
then
sel=$img/cover.gif
fi
echo -ne "\${image $sel -p 1,810 -s 75x75}"
exit 0
The conditionals are telling me "too many arguments". If I copy/paste the results into a CLI, like:
Code:
[ -e /media/Music/Some\ Song/cover.jpg] && echo "Y" || echo "N"
it works. However, if I do:
Code:
[ -e /media/Music/`mpc --format [%file%] | head -1 | tail -1 | sed -e 's/\/[^/]*\..*$//' -e 's/ /\\\ /g' -e "s/'/\\\'/g"` ] && echo "Y" || echo "N"
I get "too many arguments" again.
Hep?
Bookmarks