need a good way to determine the OS from a BASH script
Digimer
linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Tue Mar 22 17:30:23 UTC 2011
On 03/22/2011 01:11 PM, Lennart Sorensen wrote:
> On Tue, Mar 22, 2011 at 01:06:18PM -0400, Lennart Sorensen wrote:
>> On Tue, Mar 22, 2011 at 11:15:39AM -0400, Digimer wrote:
>>> On 03/22/2011 11:07 AM, Vic Gedris wrote:
>>>> "uname" is your friend for this.
>>>>
>>>> $ uname
>>>> Linux
>>>>
>>>> $ uname
>>>> SunOS
>>>>
>>>> ..etc.. Not sure what it reports for MacOS...
>>>
>>> OS X returns the name of the OS X release (ie: Darwin), and no
>>> /etc/issue exists. Look into /etc/lsb_release (man 1 lsb_release).
>>
>> How about uname -s or uname -o?
>
> Or better yet:
>
> cat /dev/null | cpp -dM
>
> On linux you see something like:
>
> #define linux 1
>
> I am sure Mac OS X defines something similar.
>
> Also Darwin is the name of the Mac OS X kernel, not a release. All Mac
> OS X releases use a kernel named Darwin.
Good to know. I don't have an Apple myself, so I'd asked a friend to get
those answers. Thanks for clarifying.
--
Digimer
E-Mail: digimer-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
AN!Whitepapers: http://alteeve.com
Node Assassin: http://nodeassassin.org
--
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