中文文件名:find 与 git ls-files / ls-tree 的区别

  • en 文件名 : OK

    git ls-files origin/dev | grep 'xx(副本)copy(副本).xxxxx' git ls-files 'xx(副本)copy(副本).xxxxx'
    "xx(\345\211\257\346\234\254)copy(\345\211\257\346\234\254).xxxxx"
    git ls-files origin/dev 'xx(副本)copy(副本).xxxxx' "xx(\345\211\257\346\234\254)copy(\345\211\257\346\234\254).xxxxx" git ls-tree origin/dev 'xx(副本)copy(副本).xxxxx'
    100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 "xx(\345\211\257\346\234\254)copy(\345\211\257\346\234\254).xxxxx"

git ls-tree / ls-tree 获得的中文文件名,是转义后的

$ git ls-tree origin/dev 'aa (副本) copy (副本) (副本).xxxxx'

100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 "aa (\345\211\257\346\234\254) copy (\345\211\257\346\234\254) (\345\211\257\346\234\254).xxxxx"

显示不正确:没有显示结果

  • 由于 git ls-tree / ls-tree 获得的文件名,是转义后的。所以 grep 在这里没有正确的结果显示。

$ git ls-tree origin/dev | grep 'aa (副本) copy (副本) (副本).xxxxx'

find 获得的中文文件名,是原样的

$ find . -name 'xx(副本)copy(副本).xxxxx' | grep 'xx(副 本)copy(副本).xxxxx'

./xx(副本)copy(副本).xxxxx

$ find . -name 'xx(副本)copy(副本).xxxxx'

./xx(副本)copy(副本).xxxxx

相关推荐
ltl7 小时前
大多数「无锁」代码其实不是无锁的
linux
ltl7 小时前
Linux 内核的内存屏障:一个让我调了三天的 bug
linux
Lonely 净土10 小时前
Rocky Linux 安装教程
linux·运维·服务器
李白你好14 小时前
Windows 离线 Linux 提权辅助查询工具
linux
Lust Dusk14 小时前
记一次Linux应急响应题目解析
linux·运维·服务器·网络·安全·网络安全
ShineWinsu15 小时前
对于Linux:五种IO模型以及非阻塞IO的详细解析
linux·c++·面试·io·阻塞·非阻塞·fcntl
千千寰宇15 小时前
[Linux/Ollama] Termux : 一款运行在 Android 平台上的开源终端模拟器与 Linux 环境应用、支持在手机上基于Ollama部署LLM
linux
程序员小八77715 小时前
一篇文章讲透 Elasticsearch:从倒排索引到实战落地
大数据·elasticsearch·搜索引擎
lingran__17 小时前
Linux 基础常用指令万字详解(上)|文件目录命令,结合底层原理剖析
linux·运维·服务器·后端·centos·linux基础指令
Dlrb121118 小时前
Linux驱动---sys文件系统自动添加设备节点、添加调试节点以及MISC设备驱动的解释
linux·imx6ull·misc·设备节点·sys文件系统