On Mon, Nov 04, 2002 at 08:00:47PM -0500, Joel Hammer wrote:
> Other posts have noted I have written bash scripts to read file names and
> rename (mv) files to essentially sort them for the xv visual schnauzer.
> 
> These scripts are fine for 50 files, but, in working with hundreds of
> files, the bash script is starting to seem slow.

You might be executing too many subshells, which slow down execution.
Try running things in the same shell using () and/or converting some
of these helper scripts to functions, which also execute in the same
shell as the caller rather than spawning a subshell. Source the functions
in a main script.  Over a few files, you won't notice the difference,
but you might see an improvement over hundreds of files.

> Perl, as I understand it, runs compiled. 

It is interpreted, compiled to an intermediate format before it is
executed. Not quite the same as compiled. However, there *are* Perl
compilers available.

> How much faster is perl than bash in reading directories, looping through
> arrays, and and mv'ing?

You'd have to do some tests, bearing in mind that there are many ways
to accomplish the same thing using Perl, and that one method for reading
directories may be faster or slower than another.

> Or, would I be better of to just bite the bullet, and write these in C ? (I
> have minimal knowledge of C, but my evenings are free of late.)

I'd write in C because it is faster by several orders of magnitude.

Kurt
-- 
Man is the only animal that blushes -- or needs to.
                -- Mark Twain
_______________________________________________
Linux-users mailing list
[EMAIL PROTECTED]
Unsubscribe/Suspend/Etc -> http://www.linux-sxs.org/mailman/listinfo/linux-users

Reply via email to