试图用mv命令将文件改名为大写时,返回不正常状态且文件没有被改名。如下:
ROOT$ touch a
ROOT$ mv a A
mv: ‘a’ and ‘A’ are the same file
ROOT$ echo $?
1
ROOT$ mv --version
mv (GNU coreutils) 8.23
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Mike Parker, David MacKenzie, and Jim Meyering.
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
某些文件系统是大小写不敏感的,在这样的文件系统下就会报同名的错喽
比如 mac 默认的日志文件系统以及 Windows 的 FAT 系列,含 NTFS
Mac 默认用的文件系统 Journaled HFS+ 是大小写不敏感的,所以改名会有问题,你或许需要用一个临时的名字中转一下。
说起来为什么不用 Mac 自带的
mv
呢,那个可以正常的修改大小写。