我在某个目录中有这种情况:
$ ls -al
...
drwxr-xr-x 2 me users 8192 Juni 28 15:27 tmp
-rw-r--r-- 1 me users 439 Jan. 3 2013
...
如何访问第二个似乎没有文件名的条目?
运行一个示例来创建一个名为“不间断空间”的文件并将其重命名:
$ ls -1 # Each file on a separate row
testfile
$ touch # I'm actually writing the character u00a0 here
$ ls -1
testfile
$ ls -i # Print inodes
2031842 testfile
2023653
$ find . -maxdepth 1 -inum 2023653 -exec mv {} hithere \;
$ ls -i1
2023653 hithere
2031842 testfile
exec
形式上的in仅在只有一个匹配项时才有意义,但是inode编号在该分区上应该是唯一的,除非存在指向同一文件的硬链接。您可以通过先运行不带参数的find来进行测试,以查看是否有多个匹配项。在这种情况下,您可以例如优化find
模式以仅匹配所需的文件。
由于重命名不取决于文件名的确切字符,因此输入奇怪的代码点应该没有问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句