-
Notifications
You must be signed in to change notification settings - Fork 2
/
32or64
executable file
·45 lines (43 loc) · 801 Bytes
/
32or64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# (c) 2020 Leif Sawyer
# License: GPL 3.0 (see https:/akhepcat/)
# Permanent home: https:/akhepcat/Miscellaneous/
# Direct download: https://raw.githubusercontent.com/akhepcat/Miscellaneous/master/32or64
#
# Prints either 32 or 64, or 'error'
MACH=$(uname -m)
if [[ -z ${MACH} || ${MACH} == "unknown" ]]
then
# Try some alternatives
# ARM
if [ -n "$(which getconf)" ]
then
MACH=$(getconf LONG_BIT)
elif [ -n "$(which dpkg)" ]
then
MACH=$(dpkg --print-architecture)
fi
fi
case "${MACH}" in
*86) BITS=32
;;
arm) BITS=32
;;
armv6l) BITS=32
;;
armv7l) BITS=32
;;
aarch) BITS=32
;;
x86_64) BITS=64
;;
amd64) BITS=64
;;
arm64) BITS=64
;;
aarch64) BITS=64
;;
other) BITS="error parsing mach: ${MACH}"
;;
esac
echo "${BITS}"