On Sun, 9 Oct 2005 19:06:53 -0700, Mark Knecht wrote:

>    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?

In addition to the resources already mentioned, there is an easy
introduction to the command line at http://www.linuxcommand.org/
> 
>    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

for f in *.wav; do command "$f" "$(basename '$f' .wav)-convert.wav"; done

> 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.

This works for a single directory, to recurse you'd need something like
find.

find somedir -name '*.wav' | while read f; do \
  command "$f" "$(dirname '$f')/$(basename '$f' .wav)-convert.wav"; \
  done


-- 
Neil Bothwick

Acute sufferer of B5 deprivation syndrome; Owner of redundant television .

Attachment: pgp3ILj6DlzCZ.pgp
Description: PGP signature

Reply via email to