Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Note that the above ksh93 script only works in locales where the decimal separator is . (so not in half the world where the decimal separator is ,). zsh doesn't have that issue. Commented Jul 23, 2014 at 6:20
  • Indeed, answer edited to clarify that point. Commented Jul 23, 2014 at 12:13
  • Setting LC_NUMERIC won't work if the user has set LC_ALL, that also means that numbers will not be displayed (or input) in the user's preferred format. See unix.stackexchange.com/questions/87745/what-does-lc-all-c-do/… for a potentially better approach. Commented Jul 23, 2014 at 12:20
  • @StéphaneChazelas fixed the LC_NUMERIC issue. Given the OP script syntax, I'm assuming his preferred separator is . anyway. Commented Jul 23, 2014 at 15:20
  • Yes, but it's the locale of the script user, not the locale of the script author that matters. As a script author, you should take localisation and its side effects into account. Commented Jul 23, 2014 at 15:29