Git: how to specify file names containing octal notation on the command line

妖精的绣舞 提交于 2019-11-29 07:30:10

In Bash, you can use printf for this kind of purpose:

$ echo `printf "\337.txt"`
▒.txt

$ git rm `printf "\337.txt"`  # this would pass the awkward filename to git

The problem is, obviously, that the shell doesn't perform octal escaping, neither does git. But printf does.


Also, echo -e can do octal escaping:

$ echo -e '\0337.txt'
▒.txt

But that usage is a bit discouraged, you should prefer printf where you can.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!