Check for the bit version of OS

Hi ,

Is there a command that i can use to check the bit version of the OS.

I have a script that i need to run on all the unix flavors so how do i check for the condition

say something like this

if( 32 bit)
{

execute this

}

else

{

execute this

}

Thanks,
Praveen

In Solaris, from the command line run this command:
/usr/bin/isainfo -kv
If your OS is 64-bit, you will see output like:
64-bit sparcv9 kernel modules
If your OS is 32-bit, you will get this output:
32-bit sparc kernel modules

For Linux users
If you are running Linux, you can check your distribution with the uname command:
uname -m
The output will read x86_64 for 64-bit and i686 or similar for 32-bit.

will tell you everything about the OS including 32/64 bit

The POSIX way of getting that information is to use the getconf utility. The relevant configuration variables are:

_POSIX_V6_ILP32_OFF32
_POSIX_V6_ILP32_OFFBIG
_POSIX_V6_LP64_OFF64
_POSIX_V6_LPBIG_OFFBIG

_POSIX_V7_ILP32_OFF32
_POSIX_V7_ILP32_OFFBIG
_POSIX_V7_LP64_OFF64
_POSIX_V7_LPBIG_OFFBIG

See the sysconf() man page for further information about these variables.

In HP-UX 11.11.

getconf KERNEL_BITS
getconf HW_CPU_SUPP_BITS