bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Redhat Linux versions


From: Bob Proulx
Subject: Re: Redhat Linux versions
Date: Sat, 12 May 2007 09:37:30 -0600
User-agent: Mutt/1.5.9i

Samba wrote:
> No I am asking using uname command option to check the OS bit versions.

The uname command may be used to report the kernel uname data in the
utsname structure.  Use of data from this structure other than the
system name is not portable because different operating systems record
different information there.

  man 2 uname

The 'uname -m' option will return the machine hardware name.  There
are many possibilities for a 32-bit or 64-bit system.  Here is one
possibility that first checks the system name and then checks the
output from -m after the system name is known.  Doing it this way
avoids some of the portability problems.

  case $(uname) in
    Linux)
      case $(uname -m) in
        x86_64|ia64) echo "64-bit" ;;
        i386|i486|i586|i686) echo "32-bit" ;;
        *) echo "machine not in list" 1>&2 ;;
      esac
    *)
      echo "system not in list" 1>&2
      ;;
  esac

But there are probably better ways to do it.  List based systems are
generally bad because the list is almost always out of date
immediately.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]