Date: Tue, 29 Dec 2009 17:44:36 -0800 (PST) From: Neil Short <neshort@yahoo.com> To: freebsd-questions@freebsd.org Cc: Dan Nelson <dnelson@allantgroup.com> Subject: Re: mplayer / bash question Message-ID: <679079.14827.qm@web56508.mail.re3.yahoo.com> In-Reply-To: <20091229171038.GJ98917@dan.emsphone.com>
next in thread | previous in thread | raw e-mail | index | archive | help
=0A=0A--- On Tue, 12/29/09, Dan Nelson <dnelson@allantgroup.com> wrote:=0A= =0A> From: Dan Nelson <dnelson@allantgroup.com>=0A> Subject: Re: mplayer / = bash question=0A> To: "Neil Short" <neshort@yahoo.com>=0A> Cc: freebsd-ques= tions@freebsd.org=0A> Date: Tuesday, December 29, 2009, 10:10 AM=0A> In the= last episode (Dec 29), Neil=0A> Short said:=0A> > I'm trying to batch-rip = audio files from a bunch of=0A> video files.=0A> > =0A> > I have a director= y full of *.vob files:=0A> > =0A> > ls *.vob=0A> > 01.vob=A0 03.vob=A0 05.v= ob=A0 07.vob=A0=0A> 09.vob=A0 11.vob=A0 13.vob=0A> > 02.vob=A0 04.vob=A0 06= ..vob=A0 08.vob=A0=0A> 10.vob=A0 12.vob=0A> > =0A> > So I wrote a little com= mand line script to rip wave=0A> files from all the=0A> > vob's:=0A> > =0A>= > > ls *.vob |=0A> > > while read f=0A> > > do=0A> > > mplayer -ao pcm:fil= e=3D`basename $f .vob`.wav $f=0A> > > done=0A> > =0A> > the first 01.wav fi= le is created successfully; but=0A> then the whole sh'bang=0A> > exits with= out ripping the rest of the vob's:=0A> =0A> Try this instead:=0A> =0A> for = f in *.vob ; do=0A> mplayer -ao pcm:file=3D${f%.vob}.wav $f=0A> done=0A> = =0A> Uses the shell's native file globbing to expand the *.vob=0A> wildcard= , and the=0A> shell's native string processing functions to remove a=0A> su= ffix.=A0 If that=0A> still doesn't work, run the script with "sh -x" to tur= n=0A> debugging on, and=0A> see what your variables are expanding to as the= script=0A> runs.=0A> =0A> -- =0A> =A0=A0=A0 Dan Nelson=0A> =A0=A0=A0 dnels= on@allantgroup.com=0A> =0A=0AThanks! It actually works. I need to get me a = good book on the shell. The man pages are ... .=0A=0A=0A
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?679079.14827.qm>