We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8ae277b commit 8678f63Copy full SHA for 8678f63
1 file changed
docs/Ch09/index.md
@@ -69,6 +69,21 @@ $ sort -n numbers
69
15
70
```
71
72
+!!! warning "sort 的结果会受到本地化配置的影响"
73
+
74
+ 在使用 sort 时,一个比如容易忽视的问题是当前的本地化配置对结果的影响。
75
76
+ ```shell
77
+ $ echo -e 'a b\naa' | LC_ALL=C sort
78
+ a b
79
+ aa
80
+ $ echo -e 'a b\naa' | LC_ALL=en_US.UTF-8 sort
81
82
83
+ ```
84
85
+ 为了获得传统意义上逐字节比较的结果,可以指定环境变量 `LC_ALL=C`。
86
87
!!! tip "小知识"
88
89
为什么有必要存在 `-o` 参数?试试重定向输出到原文件会发生什么吧。
0 commit comments