是否可以检测到32位和64位在bash脚本? [英] Is it possible to detect 32 bit vs 64 bit in a bash script?

查看:85
本文介绍了是否可以检测到32位和64位在bash脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个bash脚本来处理以自动化的方式有些安装...我有在32位或64位二进制得到这样一个程序的可能性...是有可能从bash的检测机器架构,使我可以选择正确的二进制文件?

I am writing a bash script to deal with some installations in an automated way... I have the possibility of getting one such program in 32 or 64 bit binary... is it possible to detect the machine architecture from bash so I can select the correct binary?

这将是Ubuntu机器。

This will be for Ubuntu machines.

推荐答案

确实

uname -a

给你什么,你可以使用?我没有64位机器上测试。

give you anything you can use? I don't have a 64-bit machine to test on.


迈克斯通注意:这工作,虽然具体

uname -m

会给x86_64的64位,和别的其他32位类型(在我的32位虚拟机,它的i686的)。

Will give "x86_64" for 64 bit, and something else for other 32 bit types (in my 32 bit VM, it's "i686").

这篇关于是否可以检测到32位和64位在bash脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆