case $(uname -m) in
    x86_64)  echo x86;;
    aarch64) echo arm;;
esac

又水一篇

ref

  • 上面的代码片改自这里 https://stackoverflow.com/questions/48678152/how-to-detect-386-amd64-arm-or-arm64-os-architecture-via-shell-bash
  • uname -m详细版本 https://stackoverflow.com/questions/45125516/possible-values-for-uname-m/45125525#45125525
  • uname -s检测系统是win还是mac linux写法类似。
  • uname 介绍https://gohom.win/2015/06/12/uname-shell/

contacts