Unix Review > Columns > Shell Corner

Ed Schaefer's

Shell Corner

Shell Corner: Managing Background Commands in Shell Scripts
This month, Rainer Raab discusses how to manage multiple background jobs in Korn shell scripts. After a short job control tutorial, he presents his job_monitor_status shell function that alerts the calling script when all background jobs have completed successfully or failed.
August 2004

Shell Corner: analyze-postings
As an instructor for the University of Phoenix Online, I not only work with Netnews groups for my personal interests, but professionally, too. While it’s not hard to find a Netnews reader (most email programs seem to include NNTP compatibility nowadays), it’s not very easy to do any sort of analysis of news postings, which is exactly what I need to do for my classes. I need to be able to calculate two things: total number of postings in a given period of time, and number of days during that period that there were postings. For example, if we talked about the first week of September, that’s a 7-day period, during which time a given student could post an arbitrary number of articles on any of 0-7 days.
July 2004

Shell Corner: POP3 mail filtering and retrieval with bash
This month, Chris F.A. Johnson presents Bash script mfilter, which retrieves and deletes email from a POP3 mail server. Chris also presents a short tutorial on communicating with a POP3 server.
June 2004

Shell Corner: Associative Array Usage in Python, Perl, and awk
Associative arrays are a staple of Unix productivity tools, as well as the modern ksh-style shells, ksh, bash, zsh, etc. This month, Charles Leonard discusses associative array usage in Python, Perl, and Awk.
May 2004

Shell Corner: timer — A Low-precision Visual Timer
Daniel Singer usually works in Bourne shell, with occasional forays into other languages. This month, he takes the ksh plunge, and provides us with the timer script, which demonstrates basic ksh and ksh93 features.
April 2004

Shell Corner: Dateplus: Incremented, Decremented, Repeated, and Other Tools
Shell Corner: Dateplus: Incremented, Decremented, Repeated, and Other Tools
February 2004

Shell Corner: lock_unlock — Creating and Removing a Lock File
This month, Michael Wang shows us how to correctly create and remove lock files using his lock_unlock function.
January 2004

Shell Corner: Performing Date Arithmetic with shift_date
This month, William Robertson provides Korn shell script shift_date to "add or subtract a number of days from a date".
December 2003

Shell Corner: Kameleon Shell
This month, John Spurgeon presents "the Kameleon Shell", a shell that changes colors to appear as either the Korn shell or the Bourne shell depending on the environment. This is an advanced and novel technique, and could be considered controversial. You should be acutely aware of what you are doing — be prepared for the risks and consequences. In my opinion, if you're not experienced enough to create a filesystem, you should leave Kameleon alone.
November 2003

Shell Corner: Displaying Disk Space Usage with dispus
This month, Scott Rochford presents his Perl script dispus. This personal productivity tool simpifies disk traversal and space usage analysis.
October 2003

Shell Corner: Miscellaneous Unix Tips IV
This past August, I presented the third installation in a never-ending series of Miscellaneous Unix Tips. This month, I present part IV in this series. In this column, Kyle Douglass submits the following tips: A method for finding the top 10 files (by size) on a file system. A Korn shell technique for testing two files for the same inode. A technique for sorting a file on regular fields and virtual fields. A method for executing find on files in the current working directory. A technique for cron-less automation for end users.
September 2003

Shell Corner: Today_is.pl and holidays.awk
This month, Bob Orlando shares his Perl and awk scripts for determining whether a date is a holiday, or the nth business day. Bob's work is based on holiday algorithms from Marcos J. Montes ("American Secular Holidays") and Claus Tondering ("Frequently Asked Questions about Calendars"). Bob presents his history with holiday processing, a Perl solution (today_is.pl), and finally, an awk solution (holidays.awk).
August 2003

Shell Corner: Miscellaneous Unix Tips III — "C" Tips
This month, Jonathan Leffler weighs in with a constructive criticism on May's sed column, and then presents Miscellaneous Unix Tips III — "C" Tips.
July 2003

Shell Corner: Unix Time and Perl Script
In the April 2001 Shell Corner, Andrew Barber submitted TCL script amtime.tcl, which switches the number of seconds since the Epoch to a Gregorian date string, and back again. Andy now presents the same utility in Perl. amtime.pl is a Perl script to convert Unix time-in-seconds (UTIS) to a date/time format and back.
June 2003

Shell Corner: Marking directories with pmark
This month, Bruce Israel presents "C" shell script pmark, which simplifies changing directories. pmark is an alternative to Fergal Goggin's ncd script presented in the April, 2003 Shell Corner:
May 2003

Shell Corner: He SED, She SED
This month, Mendel Cooper presents a sed tutorial, and in the process presents a DOCUMENTATION filter, a word frequency analysis script, and a script to remove "C" program comments. Mendel presents a unique random number generator: head -c4 /dev/urandom | od -N2 -tu4 | sed -ne '1s/.* //p' Originally, the /dev/urandom device is a Linux invention, but has been ported to other platforms such as FreeBSD. Some Unix variants provide the device as a patch (Solaris) or a separate product (HP-UX).
April 2003

Shell Corner: Changing Directories with ncd
This month, Fergal Goggin submits Korn/Bash script ncd, a Unix version of the Norton change directory utility. Instead of typing in long directory paths, using regular expressions, ncd greps a file for matches. If ncd finds more than one match, the user is prompted to choose the required directory.
March 2003

Shell Corner: Automating RCS with change.ss
Would you like a revision history of your Unix system files? Is more than one administrator changing files on your system? This month, Stephen Schaefer addresses these questions with Korn shell script change.ss. This script automates editing and checking files into RCS.
February 2003

Shell Corner: Scripts with a vi theme
This month, Yakov Lerner provides two vi-themed scripts. The first, vi+, allows the standard output of Unix commands to be piped into vi. The second, vman, is a wrapper script around the reference manual command, man. vman strips the formatting characters from the man command output, and places the resulting output into a vi buffer.
January 2003

Shell Corner: Processing Command-line Arguments with my_getopts
Instead of the classic shell "loop and shift", Michael Wang's 13-line Korn shell function "loops and evals" through the arguments using Korn shell pattern-matching operators.
December 2002

Shell Corner: CPT: CoPy Tree
Have you had the need to copy or move a large block of files, maybe many hundreds of megabytes, from one place to another? Or even just a small directory tree, but you want it done fast. This month, Alan Eldridge presents his cpt script, which can help copy or move large blocks of files.
November 2002

Shell Corner: Misc. Unix Tips II
Last August, I presented Miscellaneous Unix Tips; welcome to the sequel — M.U.T II! This month, Jamie Adams submits the following tips: • A method for restricting the direct logins of certain accounts. I also include two "one-liners" for restricting users to a particular terminal, and to only one session. • A Korn and "C" shell technique for quickly renaming files. • A technique for developing complex commands before issuing them to the shell. • A method for eliminating the escape characters from man pages.
October 2002

Shell Corner: Automating Tasks with Skulker
This month, John Spurgeon (john.p.spurgeon@intel.com) presents skulker, a Korn shell script that automates a variety of system maintenance tasks.
September 2002

Shell Corner: Used Named Pipes in the Shell
Instead of using temporary files in shell scripts, you could use named pipes or fifos (First-In, First-Out). This month, Nathaniel Donat (donat.n@pg.com), defines named pipes, introduces Bourne script build.ss using named pipes, and finally, directs us to some Unix Interprocess Communication (IPC) resources on the Internet.
August 2002

Finding Broken Links with linkcheck.pl
This month Bob Orlando submits Perl script linkcheck.pl to find and check broken links.
July 2002

Shell Corner: The Soundex System in C and Shell
This month, Mendel Cooper (thegrendel@theriver.com) submits a bash script called soundex.ss. The Soundex system is a hashing algorithm for surnames. It catalogs variants of a given surname, such as Smith, Smyth, and Smythe, and encodes them according to the way they are pronounced.
June 2002

Shell Corner: Processing the Oracle Alert File
Ed presents a Korn shell script called checkAlertLog.ksh, which processes errors from the Oracle Alert File and emails a report to the appropriate user. Congratulations to Naresh Puri on this winning script submission.
May 2002

Shell Corner: Cross Referencing Files with Shell and Perl
Reader Eric Lorimer submits a bash and a Perl script for cross-referencing the data of two files. Ed also demonstrates how to convert the bash script to the Korn shell.
April 2002

Shell Corner: Moving Files with Perl's Net::FTP Module
Ed presents ftp_mover.pl, a client that uses the Net::FTP module to communicate with a server. Congratulations and $100 go to Ryan Ware for submitting this winning script.
March 2002

UnixReview's Shell Corner Roundup: Unix Backup Scripts
In his monthly Shell Corner column, Ed presents a winning shell script from our reader submissions. Here, he shares three backup scripts: nfs_backup, mirrorcopy, and backup.ss. (This article originally appeared in the April 2002 issue of Sys Admin magazine. Used with permission.)
March 2002

Shell Corner: Killing Processes with killer
Ed showcases killer, a script that does everything killprog does -- and more. Congratulations and $100 go to Bruce Israel for this winning submission.
February 2002

Shell Corner: pget.awk, the Generic Parameter Parsing Engine
Ed turns the spotlight on a "Generic Parameter Parsing Engine" submitted by David Thompson.
January 2002

Shell Corner: Individual Backups with save-version
Congratulations and $100 go to Rodney Sparapani for submitting this month's winning script: an individual backup utility called save-version.
December 2001

Shell Corner: findp, Enhanced findp, and where
Congratulations and $100 go to Robert S. Sciuk for submitting this month's winning script, findp. Ed presents findp, introduces his own enhancements to it, and finally presents an alternative C program that emulates findp.
November 2001

Shell Corner: Creating User Accounts with mkusers
Some Unix variants (i.e., Solaris and SCO Open Server V) provide a command, useradd, for adding new user accounts. Bobby Higgins's (higginsbg1@home.com) Mkusers script automates the creation of user accounts by manipulating useradd and its options. Bobby also provides setpass, a "C" utility that sets a default password once a user is created, and mkusers.1, a man page for mkusers.
October 2001

Shell Corner: PST
Congratulations and $100 go to Yngve Clausen for submitting PST, a Korn script for tracing shell ancestry. Send your own stellar shell scripts to Ed, and you could be our next winner.
September 2001

Shell Corner: bfiles
This month, Dave Masterson (s97bf103@student.ucd.ie) submits bfiles, a Korn shell script that traverses directories searching for specific files.
August 2001

Shell Corner: Miscellaneous Unix Tips I
Since I began hosting this column, I've received several excellent submissions that were too short to fill an entire column. To promote a miscellaneous Unix tips forum, I've encouraged readers to enlarge the scope of their original submissions.
July 2001

Shell Corner: Merging XML Elements with mergeXML
Congratulations and $100 go to Mark Lindsey for submitting mergeXML, a bash script for merging selected elements from multiple XML files into one new file.
June 2001

Shell Corner: Directory and File Listings with dull
Daniel Singer submitted dull, this month's winning script for customizing directory and file listings.
May 2001

Shell Corner: newbackdate.ss
Continuing with the Unix time theme from last month, Randy Romano presents a Korn script, newbackdate.ss.
April 2001

Shell Corner: amtime.tcl
Ed shares feedback on cmptree before presenting Andrew Barber’s amtime.tcl script, which converts from UTIS to a useable date/time string.
March 2001

The Shell Corner: Using the Unix find Command
Congratulations and $100 go to Chris Cox for submitting this month's winning shell scripts featuring creative uses of the find command..
February 2001

The Shell Corner: cmptree
This month's winner is Ives Aerts, who submitted cmptree.
January 2001

The Shell Corner: Displaying Number Bases in the Korn Shell
Gerard van Wageningen, gerardvw@xs4all.nl, submits this month's script, convert. Convert, an autoloaded Korn shell function, displays numbers in binary, decimal, octal, hexadecimal, and base 36. (I took the liberty of adding adding base 36 for my own selfish purposes).
December 2000

The Shell Corner: Win $100 for your shell script!
Welcome to the inaugural issue of Shell Corner, hosted by Ed Schaefer.
November 2000

Sys Admin Spotlight

CMP DevNet Spotlight

Regular Expressions: Two Easy Steps Better Than One Hard One
Complicated regular expressions and yacc are powerful parsing tools, but they can cause trouble in inexperienced hands. One helpful alternative is "partial evaluation" (PE) or "active data" parsing

In the News

CD-ROM

Sys Admin and The Perl Journal CD-ROM version 11.0

Version 11.0 delivers every issue of Sys Admin from 1992 through 2005 and every issue of The Perl Journal from 1996-2002 in one convenient CD-ROM!

Order now!




MarketPlace

Instant Answers to Your IT & Business Questions
Sign Up & Get Full Access To The Definitive Online Book Collection With SkillSoft's Books24x7�.

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.

BugSplat - Automatic Crash Analysis
Fast online exception analysis. Capture customer crash data online.

Flowcharts from C/C++ code -- Free trial download
Understand C/C++ code in less time. A new team member ? Inherited legacy code ? Get up to speed faster with Crystal Flow for C/C++. Code-formatting improves readability. Flowcharts are integrated with code browser. Export flowcharts to Visio.

Wanna see your ad here?