防止 unix 树在空格前显示反斜杠
Prevent unix tree from displaying back-slash before spaces
我在命令行中经常使用命令tree
(在Mac),我当前目录的树结构如下:
└── A\ File\ with\ Space.mp4
是否有避免显示这些反斜杠的选项?
我的 tree
命令有一个 -N
选项可以按原样打印不可打印的字符。
tree -N
.
├── a dirname with spaces
└── myscript.sh
否则,您可以使用 printf
和 xargs
:
tree | xargs -L 1 -I xxxx printf "%s\n" xxxx
.
├── a dirname with spaces
└── myscript.sh
名称中的特殊字符会破坏它或显示令人惊讶的结果:\n
'
"
*
等
我在命令行中经常使用命令tree
(在Mac),我当前目录的树结构如下:
└── A\ File\ with\ Space.mp4
是否有避免显示这些反斜杠的选项?
我的 tree
命令有一个 -N
选项可以按原样打印不可打印的字符。
tree -N
.
├── a dirname with spaces
└── myscript.sh
否则,您可以使用 printf
和 xargs
:
tree | xargs -L 1 -I xxxx printf "%s\n" xxxx
.
├── a dirname with spaces
└── myscript.sh
名称中的特殊字符会破坏它或显示令人惊讶的结果:\n
'
"
*
等