Why doesn't **sort** sort the same on every machine?

后端 未结 4 1081
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 21:28

Using the same sort command with the same input produces different results on different machines. How do I fix that?

4条回答
  •  醉梦人生
    2020-12-03 21:44

    This can be the result of locale differences:

    $ echo 'CO2_
    CO_' | env LC_ALL=C sort
    CO2_
    CO_
    
    
    $ echo 'CO2_
    CO_' | env LC_ALL=en_US sort
    CO_
    CO2_
    

    Setting the LC_ALL environment variable to the same value should correct the problem.

提交回复
热议问题