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 |