GNU bug report logs -
#7991
bug in uname (?)
Previous Next
Reported by: noel <at> familie-kuntze.de
Date: Sat, 5 Feb 2011 20:56:02 UTC
Severity: normal
Done: Bob Proulx <bob <at> proulx.com>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 7991 <at> debbugs.gnu.org (full text, mbox):
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
This bug report was last modified 14 years and 108 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.