我读了 教程 这建议我在 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?

有帮助吗?

解决方案

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

我只是尝试这样做我自己,它已经建立了一个重命名的可执行文件。

其他提示

进行编译 rename 来自Linux。与说明书中的指示有一些细微差别 教程. 。我使用了文件中的2.22版本 util-linux-2.22.tar.gz

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

不要只是跑 ./configure, ,请使用带有标志的命令:

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

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

就这样,在当前文件夹中,您将拥有可执行文件,并且在 Misc-utils 中,您将拥有 man 文档(如果需要)。

轻松使用安装重命名自制

brew install rename

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

(编辑:忽略我关于构建必需品的评论 - 正如 yangyang 所指出的, ,看起来无论如何应该已经构建好了)

尝试这种情况:

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中并运行它就像红帽重命名工具:点击

$rename foo bar *.txt

打开foo1.txt,foo2.txt和foofoo.txt成bar1.txt,bar2.txt但是,有些不快,barfoo.txt。结果也许有人可以调整它来解决这个问题。

由“之前MV”把“回响”使得它输出的所有变化就会使没有使他们的列表进行测试。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top