Skip to content

Instantly share code, notes, and snippets.

@forestbaker
Created December 8, 2015 22:58
Show Gist options
  • Save forestbaker/e9d9ddb9ad233dae41de to your computer and use it in GitHub Desktop.
Save forestbaker/e9d9ddb9ad233dae41de to your computer and use it in GitHub Desktop.
Test if the kernel supports 64-bit
#!/bin/bash
# These commands test if the system is 64-bit. If not, a warning message in red is displayed, if it is 64-bit, x86_64 is displayed
[ 64 -eq $(arch | cut -c 5-) ] && arch || echo -e "\e[0;41mTHIS IS NOT A 64-BIT OS\e[0m"
[ 64=="$(arch | cut -c 5-)" ] && arch || echo -e "\e[0;41mTHIS IS NOT A 64-BIT OS\e[0m"
# Here is a new one, inspired by a post in this thread:
# http://unix.stackexchange.com/questions/12453/how-to-determine-linux-kernel-architecture
((1<<32)) && arch || echo -e "\e[0;41mTHIS IS NOT A 64-BIT OS\e[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment