> i'm trying to write a simple shell script that will output the OS type.
> does anyone know of a better way other than to just check uname?
No, uname seems to be the right solution, as uname(2) is the POSIX
function that gets all the info on a lower level and uname(1)
obviously uses uname :-)
--
Markus Kliegl
No, uname -s is as portable as it gets (it's POSIX). What's wrong with it?
sje2bk@bk4957:~ $ uname -s
FreeBSD
sje2bk@bkrfsf:~ $ uname -s
SunOS
sje2bk@bkrfsr:~ $ uname -s
Linux
Use uname -sr if you also need a revision number.
Regards,
Jens
--
Jens Schweikhardt http://www.schweikhardt.net/
SIGSIG -- signature too long (core dumped)
Depending on the level of detail you want, you might try the GNU
"config.guess" script, available at
<ftp://ftp.gnu.org/gnu/config/config.guess>
and various mirrors.
The current version is 1368 lines long. It prints something like
"sparc-sun-solaris2.7", "powerpc-ibm-aix4.3.3.0", "i586-pc-linux-gnu",
etc. (Yes, it's really Solaris 7, not Solaris 2.7, but uniqueness is
the point.)
Yes, it's pretty big, but consider whether 10 lines that you have to
write is better than 1368 lines that someone else has already written.
--
Keith Thompson (The_Other_Keith) k...@cts.com <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Cxiuj via bazo apartenas ni.
[julie:/usr/local/bin]./config.guess
./config.guess: dummy-19693.c: cannot create
The bug has not been fixed although I have reported long time ago.
Posted to comp.unix.shell and emailed to config-...@gnu.org.
Yes, I recently reported that same bug myself. It shows up if you run
it in a directory in which you can't create files.
Apparently there isn't a good portable solution. config.guess runs on
a *very* wide variety of systems; it can't even assume that it can
write files into /tmp.