Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Oct 2005 23:01:00 +1300
From:      Nick Larsen <larsen.nick@gmail.com>
To:        Fafa Hafiz Krantz <fteg@london.com>
Cc:        Will Maier <willmaier@ml1.net>, questions@freebsd.org, freebsd-questions@freebsd.org
Subject:   Re: Maintaining my music collection (off topic)
Message-ID:  <aceb91c30510310201y7f0ebc01j69b5aca88065daa0@mail.gmail.com>
In-Reply-To: <20051028112413.C680383C07@ws1-1.us4.outblaze.com>
References:  <20051028112413.C680383C07@ws1-1.us4.outblaze.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Just for shell scripters' information:

the line in the script:
PREFIX=3D"`basename ${file} | sed 's/.nfo//g'`"

could be replaced with the simpler:
PREFIX=3D"`basename ${file} .nfo`"

basename can remove whatever you give as $2

On 10/29/05, Fafa Hafiz Krantz <fteg@london.com> wrote:
>
>
> Here's what I ended up with:
>
> #!/bin/sh
> #
> # Generate SFV and M3U for all releases.
> # $URBAN: mp3.sh,v 1.0 2005/10/24 15:05:09 fafa Exp $
> #
>
> for file in `find /home/mp3 -name \*.nfo`; do
>
> DIRECTORY=3D"`dirname ${file}`"
> PREFIX=3D"`basename ${file} | sed 's/.nfo//g'`"
> CURRENT=3D"`basename ${DIRECTORY}`"
> SFV=3D"${DIRECTORY}/${PREFIX}.sfv"
> M3U=3D"${DIRECTORY}/${PREFIX}.m3u"
>
> cd ${DIRECTORY}
> rm -f *.sfv
> rm -f *.m3u
> touch ${SFV}
> cfv -C *.mp3
> cat ${CURRENT}.sfv | awk '! /^;/' > ${SFV}
> rm -f ${CURRENT}.sfv
>
> for mp3 in `find * -name \*.mp3 -maxdepth 1`; do
> echo "${mp3}" >> ${M3U}
> done
>
> done
>
> :)
>
> ----- Original Message -----
> From: "Will Maier" <willmaier@ml1.net>
> To: freebsd-questions@freebsd.org
> Subject: Re: Maintaining my music collection (off topic)
> Date: Wed, 26 Oct 2005 14:47:39 -0500
>
> >
> > On Wed, Oct 26, 2005 at 06:39:48AM -0400, Parv wrote:
> > > Looks like this script is not going to work in FreeBSD /bin/sh.
> > > Install one of shells/bash* (guessing) ports and run this script
> > > under that shell (unless somebody does the conversion for you).
> >
> > FreeBSD sh (1) supports parameter expansion, including expansions used
> > in the referenced function.
> >
> > --
> >
> > o--------------------------{ Will Maier }--------------------------o
> > | jabber:..wcmaier@jabber.ccc.de | email:..........wcmaier@ml1.net |
> > | \.........wcmaier@cae.wisc.edu <http://cae.wisc.edu>; |
> \..........wcmaier@cae.wisc.edu <http://cae.wisc.edu>; |
> > *------------------[ BSD Unix: Live Free or Die ]------------------*
>
>
>
> --
> Fafa Hafiz Krantz
> Research Designer @ http://www.bleed.com
>
>
> --
> ___________________________________________________
> Play 100s of games for FREE! http://games.mail.com/
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aceb91c30510310201y7f0ebc01j69b5aca88065daa0>