On Thu, May 20, 2021 at 04:43:49PM +0000, Michael Jensen wrote: > Repeat-By: > > echo "xxaxxon" > test.txt > echo "@zorg" >> test.txt > echo "@jupiterlander" >> test.txt > cat test.txt | sort > > Note it prints out: > > @jupiterlander > xxaxxon > @zorg > > Expected: > > @jupiterlander > @zorg > xxaxxon
The sort command is not part of bash; it's part of your operating system. If you believe it's misbehaving for your locale, you should file a bug report with your operating system vendor. However, it's possible that this is "working as intended" for your locale, which is a thing that -- once again -- your operating system vendor has decided. The behaviors of locales tend to be pretty arbitrary and surprising. If you want strict ASCII-based sorting, with no characters ignored, then you should use the "POSIX" or "C" locale setting. For example: unicorn:~$ printf '%s\n' xyz @zorg @jupiter | sort @jupiter xyz @zorg unicorn:~$ printf '%s\n' xyz @zorg @jupiter | LC_COLLATE=POSIX sort @jupiter @zorg xyz Hope this helps.