seq uses comma as decimal separator
Asked Answered
R

1

10

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?

Roadstead answered 27/5, 2014 at 8:50 Comment(0)
Y
8

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
Yesteryear answered 27/5, 2014 at 8:56 Comment(5)
Thanks, this must be related, because LANG=en_US fixes the issue on the problematic machine, but LANG=fr_FR does not create it on the machine which is working fine. Even more odd, when I echo $LANG both machines give en_US.UTF-8 as output.Roadstead
@Roadstead There must be some other variable (or maybe you don't have french on the other machine). I am not too familiar with locale stuff, try doing an env and see if there's anything interesting (maybe LC_ALL) ?Yesteryear
LC_NUMERIC was set on my machine to fi_FI.UTF-8. Changing it to en_US.UTF-8 solves the issue. What I don't understand is why ssh was passing all the language-related variables to the remote machine. Thanks for your help.Roadstead
@Roadstead Interesting. Do you have anything in .ssh/environment or the like ?Yesteryear
Not in either machine. This must be a server problem, because when I ssh into it from machine 1 echo $LC_NUMERIC gives fi_FI.UTC-8 and from machine 2 the result is en_GB.UTC-8. Moreover, when I ssh onto my own server the result is the same but the wrong seq behavior is not inherited...Roadstead

© 2022 - 2024 — McMap. All rights reserved.