Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created January 8, 2014 21:05
Show Gist options
  • Select an option

  • Save coderofsalvation/8324651 to your computer and use it in GitHub Desktop.

Select an option

Save coderofsalvation/8324651 to your computer and use it in GitHub Desktop.
check for system arch, returns [64|32]
# check for system arch, returns [64|32]
function getarch()
{
[ -z "$MACHTYPE" ] && _arch_var_arch=$(uname -m) || _arch_var_arch=$(printf "%s\\n" "$MACHTYPE" | cut -d- -f1)
case $_arch_var_arch in
x86_64)
_arch_var_arch=64;
;;
i686)
_arch_var_arch=32;
;;
*)
return 1
;;
esac
printf "%s\\n" "$_arch_var_arch"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment