need a good way to determine the OS from a BASH script

Jason Shaw grazer-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Wed Mar 23 01:11:53 UTC 2011


My macbook gives the following:

jshaw at minion:~$ uname -a
Darwin minion.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17
PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386

-jason

On Tue, Mar 22, 2011 at 9:08 PM, Eric Battersby <gyre-Ja3L+HSX0kI at public.gmane.org> wrote:

> On Tue, 22 Mar 2011, Digimer wrote:
>
> > On 03/22/2011 12:03 PM, bob 295 wrote:
> > > I'm in the process of debugging a Mac version of my SIMPL open source
> toolkit.
> > > With the GNU tools installed on the Mac the SIMPL toolkit compiles
> straight
> > > up without any conditional compilation ifdefs.    However, I've
> encountered
> > > an issue with the shmctl() function.    Linux allows a process to
> shmat()
> > > even if the segment was previously marked for destruction.   The Mac
> does
> > > not.   The reason for marking immediately after creation is to prevent
> shared
> > > memory leaks in cases of aborted processes.    As a result of this
> difference
> > > I'm going to have to introduce a conditional compile ifdef for the
> MACOSX.
> > >
> > > Ideally I'd like to be able to detect that I'm about to compile on the
> MAC
> > > inside the Makefile (or at least in the install script).    Any ideas
> on how
> > > one could reliably detect a Linux OS as opposed to a Mac OS?
> > >
> > > Thanks in advance for your help.
> > >
> > > bob
> >
> > Though it's not technically it's purpose; I've had good luck checking
> > /etc/issue for distro name and version info.
>
> Unless you need the minor distro release number,
> how is that better than 'uname -a' and then parsing the output,
> specifically the first and third fields, especially if you
> want maximum Unix/Linux portability?
>
> Does anyone know what Mac OS returns from 'uname -a'?
>
> --
> The Toronto Linux Users Group.      Meetings: http://gtalug.org/
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20110322/6d4e6f34/attachment.html>


More information about the Legacy mailing list