Watch as a red snake breaks open an oyster anticipating a new designer drug…no, that’s not what that title means. Actually, this is a scripting tutorial of some basic methods like getopts, variable manipulation, output formatting, conditionals and functions/subroutines. Scripting languages translate very much like Romance Languages — usually the quickest way to learn a second one is to simply translate your knowledge of the first one. A year ago, I had written a Zenoss-v1 device script in python, perl and bash for a friend to adjust to python with his knowledge of perl.
Originally, I was going to post it as is in this community, but since I’m not sure if the latest version of Zenoss supports it anymore, I figured it would be better to simplify it and added two more languages in the mix. If there are additional requests, we can expand this to cover some additional methods. All scripts are designed to produce the same exact output (with the exception of the debug output, which is language-based) and are structured identically so that you can understand them side-by-side.
Continue reading “Basics 101: ruby python bash perl expect php” »