Home / Programming (page 2)

Programming

Linux Programming

Perl – Executing System Commands

Perl comes with the ability to execute commands at the OS level, on any OS you are running (Linux, Windows, Mac, etc etc) There are three options available, all are different: system – Returns an exit code of the command ...

Read More »

Perl Tips And Tricks (Part 1)

A good developer tries to use as little lines of code as possible. If theres 2 ways to do something, and one takes one line, and the other takes 3, then you typically would want to go with the one ...

Read More »

Viewing Bash Exit Status Codes With Pipes

Recently I was executing bash scripts from within bash scripts, and executing commands based off of exit code, typically I just use or just the typical But now what if you are also piping the output of script.sh through tee? Then you ...

Read More »

Copy your SSH key to multiple servers from a list

We’ve all been there, you’re sitting at work and your boss gives you a task and you immediately get frustrated because not only is it one of the most annoying jobs to do but it also will consume a lot ...

Read More »

Why the GOTO Statement Is Evil

What is the goto statement? Basically, it’s a way for you to easily “jump” around in your code. You can insert “goto labels” within your code, then simply jump to that segment of your code by just inserting “goto LABELNAME”. ...

Read More »

Bash script to create MySQL database and user

I don’t know about you, but often times I find myself needing to create a MySQL database and I simply forget all of the commands. This is really something that I should remember, but for some strange reason I just ...

Read More »

Use Perl modules on remote servers.

As a Systems Administrator, mainly for Unix/Linux, you realize how big of a deal automation is. At my work, we have nearly a thousand CentOS/RHEL servers. To execute scripts or commands on a list of servers, you can use a ...

Read More »

A better nslookup

If you’re a Systems Administrator, and you use a Mac or any flavor of Linux/Unix for your workstation, chances are you have used the nslookup command, typically located at /usr/bin/nslookup. It’s a fairly simple command, used to resolve a hostname to ...

Read More »