From owner-freebsd-questions@FreeBSD.ORG Tue Dec 29 17:10:40 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A45FB106568B for ; Tue, 29 Dec 2009 17:10:40 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id 69ACF8FC1F for ; Tue, 29 Dec 2009 17:10:40 +0000 (UTC) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id nBTHAdmX079157 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 29 Dec 2009 11:10:39 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id nBTHAcwA093419 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 29 Dec 2009 11:10:39 -0600 (CST) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id nBTHAc9F093374; Tue, 29 Dec 2009 11:10:38 -0600 (CST) (envelope-from dan) Date: Tue, 29 Dec 2009 11:10:38 -0600 From: Dan Nelson To: Neil Short Message-ID: <20091229171038.GJ98917@dan.emsphone.com> References: <793133.83739.qm@web56501.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <793133.83739.qm@web56501.mail.re3.yahoo.com> X-OS: FreeBSD 7.2-STABLE User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: clamav-milter 0.95.3 at email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Tue, 29 Dec 2009 11:10:39 -0600 (CST) X-Scanned-By: MIMEDefang 2.45 Cc: freebsd-questions@freebsd.org Subject: Re: mplayer / bash question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Dec 2009 17:10:40 -0000 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@allantgroup.com