Thursday, September 19, 2013

Small Side Project

The other day, while on lunch, I decided to write a quick bash script to determine the IP of my machine.   For the first incarnation of this script, I chose Bash as it is just a quick and dirty way to achieve my goal.  
Well, after working on it for a little bit on my Linux machine, I looked to my right and saw my Macbook sitting next to me.  Being a *nix backed OS, I decided that the script also needed to support it, as well.  What the heck, why not throw Solaris into the bunch as well, seeing as I also have access to a Solaris machine.
Once I decided to take a break, I created a new repo up on Github to host the project, created a license and readme file and got my script checked into the repo.  Shortly after I put up a facebook post about the new repo, a colleague downloaded it, tested it and quickly posted a suggestion for improvement.  
I will be the first to admit that my initial design was a bit short-sighted and didn't take into account interfaces that were not active.  
I quickly went about a re-design to determine which interface(s) were active, and report their IP's.  After getting the script working as hoped on Mac, I turned my attention to Linux and Solaris.  I quickly realized that when dealing with servers, you will most likely have multiple active interfaces, including virtual (vnet) interfaes. 
Sitting here writing this, I think I may simply report each one, and also print the interface name in the output, which is currently not done.  The code is a work in progress, so if you are interested, please stay tuned and watch the updates flow.  
As always, if you have any suggestions for script improvement or if you find any bugs, please open an issue through the project on Github.  

No comments:

 
Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.