Command to tell whether it ubuntu and mac

Peng Yu pengyu.ut at gmail.com
Tue Jan 3 21:42:32 UTC 2012


On Tue, Jan 3, 2012 at 1:55 PM, Avi Greenbury <lists at avi.co> wrote:
> Peng Yu wrote:
>
>> I want to make a script work for both mac and ubuntu. Is there a
>> command that I can tell me whether I'm on an ubuntu or on a mac?
>
> Several. A mac wont, for example, have any files of the
> form /boot/vmlinuz, or a /proc.
>
> uname is probably the most appropriate one - OSX uses a Darwin kernel
> while Ubuntu uses a Linux one.
>
> What are you writing the script in? There's a few utilities that can
> help with the various changes you'll need to make to your assumptions
> for different systems.

bash. So I guess the two approaches just you suggested are sufficient.
Let me know if there are additional ones that are good with bash.

-- 
Regards,
Peng




More information about the ubuntu-users mailing list