中文文件名: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

相关推荐
你住过的屋檐3 小时前
【SeaweedFS】Linux上搭建SeaweedFS文件存储服务完整教程
linux·运维·服务器
少司府3 小时前
嵌入式外设篇(三)GPIO·三:MCU系统结构、总线与统一编制
linux·python·stm32·单片机·嵌入式硬件·mcu·嵌入式软件
不积跬步无以至千里mmbb264 小时前
Rust三大核心:Trait Crate Mod详解
linux·rust
无忧.芙桃19 小时前
Linux系统编程(四):用户与权限管理
linux·运维·服务器
戊本菌1 天前
进程(三)进程优先级:谁先上 CPU
linux·c语言·硬件架构
aningx1 天前
Arch 系用 greetd 实现开机自动进 Plasma Wayland,注销自动回桌面
linux
江无行者1 天前
Linux 服务器 top 命令详解
linux
嵌入式 Linux手记1 天前
一块内存,三种解释:union 的真实用法
linux·c语言·驱动开发·嵌入式
星恒随风1 天前
MySQL 从零入门(九):事务管理详解——ACID、COMMIT、ROLLBACK、SAVEPOINT 与四种隔离级别
linux·服务器·数据库·笔记·mysql
草莓熊Lotso1 天前
【C++ 基于微服务的即时通讯系统】ElasticSearch 用户数据管理实现
linux·数据库·c++·elasticsearch·微服务·架构