0

我阅读了建议我在 util-linux 包上运行的教程

./configure

我明白了

configuring util-linux-2.12q

You don't have <scsi/scsi.h>
You don't have <linux/blkpg.h>
You don't have <linux/kd.h>
You have <locale.h>You have <langinfo.h>
You have <sys/user.h>
You have <uuid/uuid.h>
You have <rpcsvc/nfs_prot.h>
You don't have <asm/types.h>
You don't have <linux/raw.h>
You have <stdint.h>
You don't have <sys/io.h>
You have inet_aton()
You have fsync()
You have getdomainname()
You have nanosleep()
You don't have personality()
You don't have updwtmp()
You have fseeko()
You have lchown()
You don't have rpmatch()
You have <term.h>
You have ncurses. Using <ncurses.h>.
You have termcap
You don't need -lcrypt
Strange... Static compilation fails here.
You don't have native language support
You have __progname
You don't have <pty.h> and openpty()
You have wide character support
You don't have SYS_pivot_root
You have a tm_gmtoff field in struct tm
Your rpcgen output does not compile - using pregenerated code
You have zlib
You don't have blkid

然后它建议我在 misc-utils 运行以下命令

make rename 

我收到以下警告

cc -pipe -O2 -mtune=i386 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -DNCH=1   -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" -O2  -s  rename.c   -o rename
ld warning: option -s is obsolete and being ignored

如何为 Mac 安装 rename -command?

4

5 回答 5

3

这是一个警告,而不是错误。

我自己刚刚尝试过,它已经构建了一个重命名可执行文件。

于 2009-05-27T11:28:38.290 回答
2

使用Homebrew轻松安装重命名

brew install rename
于 2013-04-10T19:46:41.543 回答
1

rename从linux编译。本教程中的指示有一些细微差别。我使用了util-linux-2.22.tar.gz文件中的 2.22 版本

下载并解压缩。转到终端中的未压缩文件夹。

不要只是运行./configure,而是使用带有标志的这个命令:

./configure --disable-su --disable-sulogin --disable-login

然后从同一个文件夹中,而不是更改为 misc-utils,您可以make rename

就是这样,在当前文件夹中,您将拥有可执行文件,如果需要,您将在 misc-utils 中获得 man 文档。

于 2013-02-28T03:43:21.887 回答
0

你不能只使用mv而不是尝试编译rename吗?甚至可能将其别名为rename?

(编辑:忽略我对 build-essentials 的评论——正如 yangyang 所指出的,它看起来应该已经构建好了)

于 2009-05-27T11:23:31.873 回答
0

尝试这个:

function rename { from=$1; to=$2; shift 2; for i in "$@"; do j=`echo $i | sed "s/$from/$to/"`; mv "$i" "$j"; done }

将其粘贴到您的 .profile 或 .bashrc 中并像 Red Hat 重命名实用程序一样运行它:

$rename foo bar *.txt

将 foo1.txt、foo2.txt 和 foofoo.txt 变成 bar1.txt、bar2.txt,但有点恼人的是 barfoo.txt。
也许有人可以调整它来解决这个问题。

通过将 'echo' 放在 'mv' 之前对其进行测试,以便它输出将进行的所有更改的列表而不进行更改。

于 2010-02-11T01:07:09.883 回答