John Chludzinski dixit:
>In Cygwin/bash 'rename' is available:
>
>$ rename .cpp .cc *.cpp
You probably installed some tool that runs as /usr/bin/rename[.exe]
which is not normally shipped on Berkeley Unix systems.
>Why was this necessary?
The entire story involves an mv(1) dynamically linked against µClibc
in a remote location on a production system and the attempt to upgrade
µClibc with a UTF-8 capable (IIRC) version in situ.
That very same day, mksh gained the following built-in command:
rename [--] from to
Renames the file from to to. Both must be complete pathnames and
on the same device. This builtin is intended for emergency situa-
tions where /bin/mv becomes unusable, and directly calls
rename(2).
The name was chosen as “rename” because it’s not exactly “mv”, nothing
provided “rename” on MirBSD or FreeWRT (or other operating systems I’ve
tried at that time), and it was deemed that others would not as easily
conflict with this as with the shorter “ren”.
I only became aware of the existence of a third-party tool called
“rename” last year or so. But, SOL. mksh has had rename for ages
(something like 2006).
By the way, this would work:
$(whence -p rename) .cpp .cc *.cpp
Or probably:
/usr/bin/rename .cpp .cc *.cpp
You can even tabcomplete the latter.
This is no different from other builtins, like true, false, [ and test,
where the version the shell ships takes precedence over the version the
OS ships (e.g. there’s a GNU false that takes --version and --help…).
bye,
//mirabilos
--
Sorry, I’m annoyed today and you came by as an Arch user. These are the
perfect victims for any crime against humanity, like systemd, feminism
or social democracy.
-- Christoph Lohmann on [email protected]