bug-coreutils
[Top][All Lists]
Advanced

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

bug#7991: bug in uname (?)


From: Bob Proulx
Subject: bug#7991: bug in uname (?)
Date: Sat, 5 Feb 2011 16:12:41 -0700
User-agent: Mutt/1.5.20 (2009-06-14)

Noel Kuntze wrote:
> It seems to me that the options for uname, more precise, -v and -r have
> been interchanged.

The uname program dates back to the days of yore before we had refined
networking to the mature state that it is now.  It is really a
terrible interface.  Although we often use 'uname -a' to identify
systems it isn't out of love but simple practicality that there isn't
much better available.

If you collected the output of uname with various options on every
different system you could find you would have quite a collection of
random output!  At that point you would understand the problem.

The only portable use of uname is without arguments.  To use it
portably you can only really use it first to figure out which system
you are on and then follow that up with subsequent calls with system
specific options.  I often do this type of thing in scripts:

case $(uname) in
  HP-UX)
    case $(uname -m) in
      9000/*)
        case $(getconf CPU_VERSION) in
          528) mach=hppa1.1 ;;
          532) mach=hppa2.0 ;;
          768) mach=ia64 ;;
        esac
        ;;
      *) mach=$(uname -m) ;;
    esac
    sys=hpux$(uname -r | sed 's/^[AB]\.//')
    ;;
  Linux)
    sys=gnulinux
    mach=$(uname -m)
    ;;
  AIX)
    sys=aix
    mach=rs6000
    ...
    ;;
esac

That is just an example.  Such as for AIX I would need to do more but
I didn't want to keep going with the example.

Bob





reply via email to

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