Various examples of shell scripts. For the full list of scripts, click here.

getcluster - GetCluster

determine what installation cluster(s) are required to get a given package to be installed on Sun Solaris.
(here's a sample clustertoc file to get it working; it looks for Solaris install media in /cdrom/cdrom0, /cdrom, /mnt after checking the current directory).
README

MPG - Miles Per Gallon

A sample script which converts $X miles for $Y litres into $Z MPG

BCD - Binary Coded Decimal

This was requested by a reader, so here's a sample script to do BCD.

check_dups

Check for Duplicate Files.
There are a number of things you can do with this - the bravest is to pick one to delete; the most sensible is to list duplicates, so that the user can use that information according to their wishes.

mkkernel

I wrote various stuff for DRS/NX, which taught me a lot about shell scripting - here they are, in all their ugly glory...
intel | notes | updated (a partially updated version, which I must actually complete - fixing the errors, noting why certain things in the original were bad, and how the can be done better) | readme | sparc

Getopt

- How to use getopt in a shell script.

ppp-test

This was written for my speedtouchconf.sourceforge.net project - a way of testing if a PPP (or any other) link is active.

rterm

Remote Terminal. Rterm is a simple utility to log into boxes. The EMULATOR variable should point to something which takes xterm-style parameters, namely "-T" for the window title, and "-e" for a command to execute. Personally, I use kvt. You can hardcode your fave machine into the code, so "rterm" by itself will go into that box, or "rterm host" will connect to host. "rterm host user" will connect to host host as user user.

title

Set the title of an xterm (works on konsole, gnome-terminal, etc) via ANSI codes.

Simple Network Analysis Tool

Here is a tool I wrote a while ago, not yet documented.

trasher

A simple script to trash file contents. Not exactly secure, but makes a decent attempt. Read the disclaimers in the script itself.

IPTCFG

That's all the documentation you get for iptcfg...

Tutorial Scripts

Various scripts related to the Shell Scripting Tutorial are available here and here.

Stolen Scripts

ocl.ksh

Written by Liam Crilly, who I went to college with. We had a challenge to write a "rough time" script... Liam's was far better than mine :-)

rlogout

Also written by Liam, and taken for posterity.
Steve's Bourne / Bash shell scripting tutorial
Share on Twitter Share on Facebook Share on LinkedIn Share on Identi.ca Share on StumbleUpon