mplayer / bash question
Neil Short
neshort at yahoo.com
Wed Dec 30 01:57:36 UTC 2009
--- On Tue, 12/29/09, Dan Nelson <dnelson at allantgroup.com> wrote:
> From: Dan Nelson <dnelson at allantgroup.com>
> Subject: Re: mplayer / bash question
> To: "Neil Short" <neshort at yahoo.com>
> Cc: freebsd-questions at freebsd.org
> Date: Tuesday, December 29, 2009, 10:10 AM
> In the last episode (Dec 29), Neil
> Short said:
> > I'm trying to batch-rip audio files from a bunch of
> video files.
> >
> > I have a directory full of *.vob files:
> >
> > ls *.vob
> > 01.vob 03.vob 05.vob 07.vob
> 09.vob 11.vob 13.vob
> > 02.vob 04.vob 06..vob 08.vob
> 10.vob 12.vob
> >
> > So I wrote a little command line script to rip wave
> files from all the
> > vob's:
> >
> > > ls *.vob |
> > > while read f
> > > do
> > > mplayer -ao pcm:file=`basename $f .vob`.wav $f
> > > done
> >
> > the first 01.wav file is created successfully; but
> then the whole sh'bang
> > exits without ripping the rest of the vob's:
>
> Try this instead:
>
> for f in *.vob ; do
> mplayer -ao pcm:file=${f%.vob}.wav $f
> done
>
> Uses the shell's native file globbing to expand the *.vob
> wildcard, and the
> shell's native string processing functions to remove a
> suffix. If that
> still doesn't work, run the script with "sh -x" to turn
> debugging on, and
> see what your variables are expanding to as the script
> runs.
>
> --
> Dan Nelson
> dnelson at allantgroup.com
>
Thanks! It actually works. I need to get me a good book on the shell. The man pages are ... .
More information about the freebsd-questions
mailing list