From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.50) id 1EPEaA-00050s-66 for garchives@archives.gentoo.org; Tue, 11 Oct 2005 07:29:54 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id j9B7Jk7p023949; Tue, 11 Oct 2005 07:19:46 GMT Received: from relay02.roc.ny.frontiernet.net (relay02.roc.ny.frontiernet.net [66.133.182.165]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id j9B7GBSv027365 for ; Tue, 11 Oct 2005 07:16:12 GMT Received: from filter10.roc.ny.frontiernet.net (filter10.roc.ny.frontiernet.net [66.133.183.77]) by relay02.roc.ny.frontiernet.net (Postfix) with ESMTP id 8E53B37003D for ; Tue, 11 Oct 2005 07:25:38 +0000 (UTC) Received: from relay02.roc.ny.frontiernet.net ([66.133.182.165]) by filter10.roc.ny.frontiernet.net (filter10.roc.ny.frontiernet.net [66.133.183.77]) (amavisd-new, port 10024) with LMTP id 03714-12-74 for ; Tue, 11 Oct 2005 07:25:38 +0000 (UTC) Received: from blacklamb.mykitchentable.net (67-51-164-214.dsl1.elk.ca.frontiernet.net [67.51.164.214]) by relay02.roc.ny.frontiernet.net (Postfix) with ESMTP id 3E0AE370015 for ; Tue, 11 Oct 2005 07:25:31 +0000 (UTC) Received: from [192.168.1.16] (unknown [192.168.1.16]) by blacklamb.mykitchentable.net (Postfix) with ESMTP id B9468154FC7 for ; Tue, 11 Oct 2005 00:25:30 -0700 (PDT) Message-ID: <434B68EB.6000903@mykitchentable.net> Date: Tue, 11 Oct 2005 00:25:31 -0700 From: Drew Tomlinson User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Simple command line stuff References: <5bdc1c8b0510091906s2631d15bh46dc269fcb312534@mail.gmail.com> <1128934837.3551.1.camel@Darkmere.darkmere> <5bdc1c8b0510100757v3c7396ccs79eeb5343f8dd57c@mail.gmail.com> In-Reply-To: <5bdc1c8b0510100757v3c7396ccs79eeb5343f8dd57c@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-2.3.2 (20050629) at filter10.roc.ny.frontiernet.net X-Archives-Salt: 6d7b4119-2b7b-468a-a6b8-5d690792e0db X-Archives-Hash: 5d1a349bcbacf0c00a7512bd95bf356e Mark Knecht wrote: >On 10/10/05, Spider (D.m.D. Lj.) wrote: > > >>On Sun, 2005-10-09 at 19:06 -0700, Mark Knecht wrote: >> >> >>>Hi, >>> I don't have a single book on Linux. (Amazing...) Can someone >>>recommend a simple book on command line stuff, or better yet a good >>>web site on this topic? >>> >>> For instance, I wanted to run a specific command on every file in a >>>directory which will create a new file, so I need to do >>> >>>command file1.wav file1-convert.wav >>> >>>I need to take each name, create a new name to build the actual >>>command that gets run and then do that for every file in the >>>directory, or even in a hierarchy of directories. >>> >>>Thanks, >>>Mark >>> >>> >> >>For bash / zsh and other advanced(?-) shells: >> >>for f in *.wav; do command "$f" "${f/.wav/-convert.wav}";done >> >>The " " are there to prevent files with spaces in them (evil!) from >>becoming too annoying and appearing as multiple commandline arguments. >> >> >>//Spider >> >> >> > >Thanks to all for the great answers and pointers. I appreciate it very much. > >Cheers, >Mark > > And just one more point. The "for" loop is shell dependent and works in sh and its cousins. But if you're using a csh based shell, it's "foreach". Now I'm not commenting on what shells are better than others but just wanted to make the point for anyone who might follow this thread in the future. Oh, and another thought. The "find" command can do this for you as well, IIRC. Cheers, Drew -- gentoo-user@gentoo.org mailing list