bash seq 使用逗号作为小数点分隔符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23884934/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
seq uses comma as decimal separator
提问by Miguel
I have noticed a strange seq
behavior on one of my computers (Ubuntu LTS 14.04): instead of using points as decimal separator it is using commas:
我注意到seq
我的一台计算机 (Ubuntu LTS 14.04) 上出现了一个奇怪的行为:它使用逗号而不是使用点作为小数点分隔符:
seq 0. 0.1 0.2
0,0
0,1
0,2
The same version of seq (8.21) on my other PC gives the normal points (also same Ubuntu version). The strangest thing is that I am observing the same ill behavior on a remote machine when I ssh into it from the first machine. Even a bash script submitted from the conflictive machine to a job scheduler (slurm) on the remote machine is having this problem. I am very confused. Why (and how!) is this happening?
我的另一台 PC 上相同版本的 seq (8.21) 给出了正常点(也是相同的 Ubuntu 版本)。最奇怪的是,当我从第一台机器 ssh 进入远程机器时,我在远程机器上观察到同样的不良行为。甚至从冲突机器提交到远程机器上的作业调度程序 (slurm) 的 bash 脚本也存在此问题。我很困扰。为什么(以及如何!)会发生这种情况?
采纳答案by cnicutar
It's likely the LANG
variable or some other locale-specific variable. On a computer where seq
behaves "normally" try:
它可能是LANG
变量或其他一些特定于语言环境的变量。在seq
行为“正常”的计算机上尝试:
$ LANG=fr_FR seq 0. 0.1 0.2
0,0
0,1
0,2
$ LANG=en_US seq 0. 0.1 0.2
0.0
0.1
0.2