Just 'uname' is not specific enough. On SCO UNIX 3.2V4.2 uname defaults to 'uname -s'. On AlphaServer with Digital UNIX 4.0g or TRU64 V5.1B I get 'OSF1' as answer. On HP-UX 11.23/11.31 I get 'HP-UX'.

Even if I do a 'uname -m' I may still do additional 'uname [-<argument>]' for other specifics. Of course a 'uname -a' and 'set -- $*' would be a possibility.

On Mon, 27 Dec 2021 at 10:43, Greg 'groggy' Lehey <grog@lemis.com> wrote:
On Monday, 27 December 2021 at  9:52:24 +0700, Rudi Blom wrote:
> My official status seems a bit unclear (although I'm getting paid :-) ) but
> unofficially I keep an eye on a lot of a customers servers. Ad-hoc shell
> scripts still have similar structure as I know how to 'cut and paste'.
>
> These scripts are run remotely via a 'homegrown' client-server setup. Many
> should run on different UNIX environments and therefore have near the
> beginning an OS check. Depending on that I can set PATH and anything else
> important.
>
> #
> # check what type of OS this system runs on
> #
> OST=`uname -m`

That's the architecture.  Wouldn't just `uname` be better?  I have:

  case `uname` in
  Linux)
    PATH=.:~:/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin:/usr/local/bitkeeper:/Photos/Tools
    export SHELL=/bin/bash
    ;;

  NetBSD)
    PATH=.:~:/usr/pkg/bin::/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin:/usr/local/bitkeeper:/usr/local/gnu-autotools/bin:~:/Photos/Tools
    export SHELL=/usr/pkg/bin/bash
    ;;

  FreeBSD)
    PATH=.:~:/home/local/bin:/usr/local/bin:/usr/local/sbin:~/bin:/usr/bin:/usr/sbin:/bin:/sbin:/Photos/Tools:~
    export SHELL=/usr/local/bin/bash
    ;;
...

And yes, lm, if you're looking, there's really a /usr/local/bitkeeper
in there.  It's been years, but I don't tidy these things up very
often.  I only just removed mosaic from my fvwm2 config menus.

Greg
--
Sent from my desktop computer.
Finger grog@lemis.com for PGP public key.
See complete headers for address and phone numbers.
This message is digitally signed.  If your Microsoft mail program
reports problems, please read http://lemis.com/broken-MUA.php


--
The more I learn the better I understand I know nothing.