History of Rename, as I Know It (Re: "rename" shell command)

parv parv at pair.com
Mon Jan 26 17:23:46 PST 2004


in message <40152820.5080206 at tue.nl>, wrote Andrew Kotsopoulos
thusly...
>
> parv wrote:
>
> >  http://groups.google.com/groups?th=b45310c8ba0519a
>
> Thanks for the tips to all that responded to me - I've seen quite
> a few suggestions for scripts of various kinds.

Did you send personalized email to everybody or you forgot to copy
-questions?


> what I really want to know is what's the offical story with
> "rename"?  On my redhat 8 dist. it's a binary and lives in
> /usr/bin.  I believe it was part of the fileutils or coreutils
> package and they are supposed to be GNU packages (or not?)

The original "rename" was, as i know it, from Larry wall, creator of
Perl.  From http://groups.google.com/groups?selm=33089%40adm.brl.mil
...

    If you have the "perl" language installed, you may find this
    rename script by Larry Wall very useful.  It can be used to
    accomplish a wide variety of filename changes.

    #!/usr/bin/perl
    #
    # rename script examples from lwall:
    #       rename 's/\.orig$//' *.orig
    #       rename 'y/A-Z/a-z/ unless /^Make/' *
    #       rename '$_ .= ".bad"' *.f
    #       rename 'print "$_: "; s/foo/bar/ if <stdin> =~ /^y/i' *

    $op = shift;
    for (@ARGV) {
        $was = $_;
        eval $op;
        die $@ if $@;
        rename($was,$_) unless $was eq $_;
    }


...I heard/read once about it when i was starting with Perl more than
5 years ago.  The original "rename" was not part of the standard Perl
distribution; it was included by distributor(s) of Linux...

  http://www.oclug.on.ca/pipermail/oclug/2002-March/018696.html


...which mentions your RedHat too, besides mentioning that rename
appeared in "Programming Perl", first edition.


It seems to appear & had appeared under similar name for the same
purpose.  Sometimes the program is wholly independent, else it is
enhancement of the original.  Mother necessity is of invention, or
something like that.

I also noticed some blurb in comp.* newsgroup that involved "C" and
"rename".  Oh wait ...

  #  man -aw rename

...ok, there is also rename(2), a C library function, in libc, that
"conform[s] to ISO/IEC 9945-1:1996 (``POSIX.1'')".


  - Parv

-- 



More information about the freebsd-questions mailing list