I want to get the string arm64
in a bash script.
root@ubuntu-arm-test:# uname -a
Linux ubuntu-arm-test 5.15.0-105-generic #115-Ubuntu SMP Mon Apr 15 09:52:04 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
I could do something like this:
#!/bin/bash
# Get the machine hardware name
arch=$(uname -m)
# Convert aarch64 to arm64
if [ "$arch" == "aarch64" ]; then
echo "arm64"
else
echo "$arch"
fi
But I would like to have a simpler way.
2
Answers
On Debian systems you can use:
You can do this in one line using
sed
: