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

phiscock-g851W1bGYuGnS0EtXVNi6w at public.gmane.org phiscock-g851W1bGYuGnS0EtXVNi6w at public.gmane.org
Wed Mar 23 02:29:37 UTC 2011


Dunno if this is useful, but Tcl has a command (TclPlatorm, maybe?) that
you can use to detect the OS. We use that to select the I/0 routines in
our software.

Peter

> 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
> --
> 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
>


-- 
Peter Hiscocks
Syscomp Electronic Design Limited, Toronto
http://www.syscompdesign.com
USB Oscilloscope and Waveform Generator
647-839-0325

--
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





More information about the Legacy mailing list