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

-- 
begin  .signature
Tortured users / Laughing in pain
See Microsoft KB Article Q265230 for more information.
end

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to