seq uses comma as decimal separator

2019-04-07 01:00发布

问题:

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 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?

回答1:

It's likely the LANG variable or some other locale-specific variable. On a computer where seq behaves "normally" try:

$ 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