Gentoo Archives: gentoo-user

From: "Spider (D.m.D. Lj.)" <spider@g.o>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Simple command line stuff
Date: Mon, 10 Oct 2005 09:05:07
Message-Id: 1128934837.3551.1.camel@Darkmere.darkmere
In Reply to: [gentoo-user] Simple command line stuff by Mark Knecht
1 On Sun, 2005-10-09 at 19:06 -0700, Mark Knecht wrote:
2 > Hi,
3 > I don't have a single book on Linux. (Amazing...) Can someone
4 > recommend a simple book on command line stuff, or better yet a good
5 > web site on this topic?
6 >
7 > For instance, I wanted to run a specific command on every file in a
8 > directory which will create a new file, so I need to do
9 >
10 > command file1.wav file1-convert.wav
11 >
12 > I need to take each name, create a new name to build the actual
13 > command that gets run and then do that for every file in the
14 > directory, or even in a hierarchy of directories.
15 >
16 > Thanks,
17 > Mark
18
19
20
21 For bash / zsh and other advanced(?-) shells:
22
23 for f in *.wav; do command "$f" "${f/.wav/-convert.wav}";done
24
25 The " " are there to prevent files with spaces in them (evil!) from
26 becoming too annoying and appearing as multiple commandline arguments.
27
28
29 //Spider
30
31 --
32 begin .signature
33 Tortured users / Laughing in pain
34 See Microsoft KB Article Q265230 for more information.
35 end

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Simple command line stuff Mark Knecht <markknecht@×××××.com>