The ‘Bourne shell scripting’ Archives
Posted November 18, 2010 by

Bourne/bash shell scripts: string comparison

Brief tutorial describing how to do string comparisons. Recently updated thanks to comments from our users.

Posted April 12, 2007 by

A simple script that waits for a process to complete and then executes a command

It is often necessary under unix/linux to wait for certain processes to complete before running other processes. At best this can cause needless delays and wasted time, while in the worst cases someone may actually forget to run some final processing.

Posted September 2, 2005 by

Simple Menu for User Input

This script will create an input screen in BASH that allows the user to enter information just as they would in a window. This is to show the use of simple functions as well as the tput command. The command “tput cup” allows the developer to place the cursor anywhere on the screen. There are […]

Posted June 8, 2005 by

A Simple Function for Printing Colorful Text

The following function to print text with colors can be extended easily.

Posted June 8, 2005 by

Queue and Stack Using an Array

This Tech-Recipes tutorial contains a series of operations on an array. We can use these functions to implement a queue or a stack that can be of better use to us.

Posted June 8, 2005 by

Bash Array Operations

Sometimes we need to remove one element from an array. This Tech-Recipes tutorial contains an example.

Posted August 31, 2004 by

Bash Shell Script Accessing Array Variables

The bash shell allows a number of methods for accessing elements of variable arrays. This tech-recipe demonstrates some of these techniques.

Posted August 30, 2004 by

Bash Shell Script Iterate Through Array Values

Having an array of variables is of no use unless you can use those values somehow. This tech-recipe shows a few methods for looping through the values of an array in the bash shell.

Posted August 30, 2004 by

bash shell script declaring/creating arrays

The use of array variable structures can be invaluable. This recipe describes several methods for declaring arrays in bash scripts.

Posted August 5, 2004 by

Bourne/Bash Shell Script Functions

Writing functions can greatly simplify a program. If a chunk of code is used multiple times in different parts of a script, the code can be enclosed within a function and run using only the function name.

Posted January 9, 2004 by

Bourne/Bash Shell Script: While Loop Syntax

A while loop allows execution of a code block an arbitrary number of times until a condition is met. This tech-recipe describes the while loop syntax for the various Bourne shells (sh, ksh, bash, zsh, etc.) and provides examples.

Posted December 15, 2003 by

Hide password entry in Bourne/bash shell script

Common practice for inputing passwords is to read the text without displaying it on the screen. The UNIX Bourne shell does not have this functionality as a command, but a combination of commands will make this work.