Created
November 3, 2014 14:52
-
-
Save Frodox/017329761281fc49bf72 to your computer and use it in GitHub Desktop.
Detect, if you have BE/LE system from shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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