Command to tell whether it ubuntu and mac
Hal Burgiss
hal at burgiss.net
Wed Jan 4 02:39:57 UTC 2012
On Tue, Jan 3, 2012 at 4:42 PM, Peng Yu <pengyu.ut at gmail.com> wrote:
> 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?
> >
>
uname would probably give you what you need.
$ uname -o
GNU/Linux
On my Macbook, I get something like 'Darwin'. YMMV.
$ uname -o |grep Linux>/dev/null && is_linux=true || is_linux=false
$ echo $is_linux
true
--
Hal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20120103/accd2963/attachment.html>
More information about the ubuntu-users
mailing list