Using the same sort command with the same input produces different results on different machines. How do I fix that?
For more than you ever wanted to know about sort, read the specification of sort in the Single Unix Specification v3. It states
Comparisons [...] shall be performed using the collating sequence of the current locale.
IOW, how sort sorts is dependent on the locale (language) settings of the environment that the script is running under.