July 2008

Shell Script, While Read

Posted by Ryan on July 26, 2008 in Linux, Solaris

The “while read” function of shell scripting is great for performing a common task on multiple pieces of data. Here, check out the code section, and I’ll explain more.
Purpose: To check if multiple rpm packages are installed on a linux OS.
Code:
#!/bin/sh
while read i #read from input and assign the variable “i” to each [...]

Perl Script, backup speeds v1.2

Posted by Ryan on July 20, 2008 in ComputerInfo

Ok here’s the new version.  This includes media average needed per lto generation.
 Code:
#!/usr/bin/perl
print “Enter the letter of the magnitude of data you need to backup (T(era),G(ig),M(eg),K(ilo)).\n”;
chomp($mag1 = <STDIN>); #takes the user input and assigns it to $mag1.
print “Enter the amount of the data you need to backup (1-999).\n”;
chomp($dataamt = <STDIN>); #takes the user input and [...]

Perl Script, backup speeds v1.1

Posted by Ryan on July 17, 2008 in ComputerInfo

Ok here’s the new one…This allows the user to define T, G or M for Terabytes, Gigabytes or Megabytes.  Then enter a number between 1-999 that is then multiplied to the power the user specified in the previous step.
Future:
Still, make it dummy proof!
Code:
#!/usr/bin/perl
print “Enter the letter of the magnitude of data you need to backup [...]

Perl Script, backup speeds v1.0

Posted by Ryan on July 16, 2008 in ComputerInfo

This is as far as I’ve gotten with Perl (about 40 pages into the llama book actually..hey, its a start).  The reason I made this script is to easily calculate the time it would take to backup a specified amount of data to a specified device.
Future improvements:
User specified data, in short-hand…not just in bytes.  – [...]