Category Archives: Bash Scripting

Lame Scripting Awards

Lame Scripting Awards

How many people have been using cat to open files in their shell only to pipe the output to another command, or how many have piped things to wc -l from grep? Don’t understand what I am talking about, and want to be enlightened? Check out: Useless use of cat award. This is an old article but the information is probably more relevant than some other information presented in class or online. Lets be honest though and realize that there is more than one way to skin a scripted cat.

Mysql Script Tools

Mysql Script Tools

There are a number of operations in mysql that could benefit from being optimized in a script that performs these actions on all tables. A List of maintenance commands can be found. As it is, currently I have created a number of scripts for performing Analysis, Backup, Check, Checksum, Optimize, Repair, Restore. The tools are designed to operate on all table names accessible from the INFORMATION_SCHEMA.TABLES with the exception of the information_schema tables.

Continue reading

Using Perl to time Bash Calls – Bash fine grain timer

Using Perl to time Bash Calls – Bash fine grain timer

I was looking for a way to cross platform way to make a microsecond timer or anything less than one second for that matter in bash. Aside from doing a fork each time this function needs to be called, this is a pretty good alternative to c programming because it is quick and dirty. This function will allow us to be portable and not think too much about the implementation for the time being.

#!/usr/bin/perl
use strict;
use warnings;
use Time::HiRes qw(usleep nanosleep);
usleep(100);

Bash Multi Get using wget

Bash Multi-Get using wget

If you were ever looking at using wget with a proxy – then this is probably the script for you. I haven&squo;t spent much time testing this and it requires a helper program written in perl to get the timer resolution to handle properly. The idea behind this script is to be able to traverse a list of proxies so that you can test accessing your site from a bunch of “different places at once”.
Continue reading

Bash SQL Query Helper

What is Bash SQL Query Helper?

This script is a very simple script that helps one to run sql commands from the command line with the command name and the query as opposed to running all sorts of switches. This is definately not a complicated script and there are probably some security considerations around using such a script with certain fields saved in it. But the main goal is to be able to call the mysql client to give me a result set as simple as possible.

Continue reading

Allocate Version Numbers With Bash

Allocate Version Numbers With Bash

Bash at it&squo;s simplest form is a program that runs other programs for you based on input. Bash also has some other features than this such as the ability to store and retrieve variables stored in the Environment for a shell. If you invoke bash and then exit, you will loose the Environment that was set inside the script unless some special things are done.
Continue reading