2

I want to write a bash script to get some information of Switches through snmpbulkwalk. I would like to use the same script in Linux and OSX environments, so I want to know if there is a way to do a compatible version that identifies the current OS, get the needed SNMP packages for each one and run a bunch of commands.

Thanks in advance.

2
  • Like uname ? Or do you mean something else?
    – user14755
    Sep 18, 2015 at 4:17
  • That's right! I completely forgot about the uname... Thanks! Sep 18, 2015 at 16:29

1 Answer 1

1

As far as I know, uname will display the generic name of the operating system.

My roommate has the latest (I think) version of OSX, and it displays Darwin when it runs.

If you'd like more of an output, uname -a will give you the kernel version, OS version, and a bunch of other information, in addition to the generic name.

That said, this doesn't always properly fingerprint an OS. My CentOS VPS displays Linux, or GNU/Linux, depending on what I run.

I'm also just a college student who does this kind of stuff for fun (/ on my development server), so there may be a better answer to this.

1
  • For telling Linux from OS X, uname alone will work. If you want to fingerprint a specific Linux distro, or if you expect to actually run on something from the OpenDarwin/PureDarwin family and need to tell that apart from OS X, you'd need a more sophisticated tool.
    – Tom Hunt
    Sep 18, 2015 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.