Skip to content

Instantly share code, notes, and snippets.

@Frodox
Created November 3, 2014 14:52
Show Gist options
  • Save Frodox/017329761281fc49bf72 to your computer and use it in GitHub Desktop.
Save Frodox/017329761281fc49bf72 to your computer and use it in GitHub Desktop.
Detect, if you have BE/LE system from shell
#!/bin/bash
# little endian - forward byte order
# big endian - reverse byte order
echo "You have 32 bit system (1), 64bit (0)"
echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6
# cc: http://serverfault.com/questions/163487/linux-how-to-tell-if-system-is-big-endian-or-little-endian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment