PDA

View Full Version : Bash check for 64bit?


sea
21st June 2011, 07:34 PM
Heyas

As i just started to write scripts, i'd obviously like automize some actions, therefor i'd like to check the users system if its 64bit.
Is there a function to check this?

And my other question, were's a good start to get into bash scripting, the files i use as template gave pretty much good info, but yet i have no idea what i'm actualy doing :C :rolleyes:

Thanks in advance.
Cheerio

CronoCloud
21st June 2011, 07:53 PM
Heyas

As i just started to write scripts, i'd obviously like automize some actions, therefor i'd like to check the users system if its 64bit.
Is there a function to check this?

Try this:


#!/bin/bash
if [ "$(uname -m)" = "x86_64" ]; then
echo "This is an x86_64 Linux"
else
echo "This is NOT an x86_64 Linux"
fi


CronoCloud

sea
21st June 2011, 08:35 PM

Thank you :)

smr54
21st June 2011, 11:37 PM
I have a page where I list some good, in my opinion, links, but your mileage may vary. Some folks love the advanced bash scripting guide, I didn't find it helpful, for example.

Anyway, you can take a look at
http://home.roadrunner.com/~computertaijutsu/shellscripting.html and see if any of the links there are useful for you. Personally, I found the best, for my limited skills were the Daniel Robbins ones and the Vivek Gite ones.

stevea
23rd June 2011, 04:37 AM
The 'arch' command is part of coreutils. Basically the same as 'uname -m'