本文介绍了为什么bash的"回声[T]"导致" T"不" [T]"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此情况用于字符t和的值根。令人困惑
$回声[S]
[S]
$回声[T]
ŧ
$回声[T]
[T]
$回声[根]
ŧ
解决方案
作为一个没有外壳常客(并不愿意成为),我发现令人惊讶的扩展名是如何设计的时候没有找到匹配的行为。我会报告
The good news is this thing is configurable. The bad one is a script can fail in a number of ways one doesn't expect - at least, I did not, and it took me some time to understand why echo
behaves the way you posted, just to find that it's because of a combination of weird filenames (who ever wants to name a file t
?), hidden configuration (nullglob
disabled, default option but still hidden) and a harmless command.
I said harmless because this is what you get, for example, when the target is ls
(a failure because the file is not found):
raffaele@Aldebaran:~$ mkdir test
raffaele@Aldebaran:~$ cd test
raffaele@Aldebaran:~/test$ touch t
raffaele@Aldebaran:~/test$ ls [t]
t
raffaele@Aldebaran:~/test$ ls [v]
ls: cannot access [v]: No such file or directory
这篇关于为什么bash的"回声[T]"导致" T"不" [T]"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!