Menu

#1 func/audiofunc.sh mp3 detection

open
nobody
None
5
2007-04-07
2007-04-07
No

mp3/ogg/flac detection didn't work for me, it returned this error if no mp3s were found:
/usr/local/BashBurn/func/audiofunc.sh: line 25: [: -gt: unary operator expected
and this if more than one were found:
/usr/local/BashBurn/func/audiofunc.sh: line 25: [: too many arguments
so i figured out that when it finds some files, bash expands
if [ $(find ${BBBURNDIR} -iname "*.[Mm][Pp]3") -gt 0 ]; then
to something like
if [ file1.mp3 file2.mp3 file3.mp3 -gt 0 ]; then
which causes the too many arguments error. changing line 25 (and the similar lines for ogg and flac) to this fixed it for me:
RES=`find ${BBBURNDIR} -iname "*.[Mm][Pp]3" &>/dev/null`
if [ "$RES" != 0 ]; then
but i'm not that good at bash so there's probably a better way to do that.

hope this helps

Discussion

  • Nobody/Anonymous

    Logged In: NO

    it works if you write line 25 (and, of course, the same to ogg and flac) like this:

    if [ $(find ${BBBURNDIR} -iname "*.[Mm][Pp]3" | wc -l) -gt 0 ]
    ^^^^^^^

     
  • mazdac

    mazdac - 2007-07-26

    Logged In: YES
    user_id=1467799
    Originator: NO

    or more minialistic (without using wc):

    if [ -n "$(find ${BBBURNDIR} -iname "*.[Mm][Pp]3")" ]

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.