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.
Category Bourne shell scripting
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.
Category Bourne shell scripting
Bourne/Bash Shell Script for Loop Syntax
A for loop allows a program to iterate over a set of values. For loops in a Bourne shell script (sh, ksh, bash, zsh, etc.) are a useful means of iterating through files or other lists. This tech-recipe describes the for loop syntax and provides some examples.
Category Bourne shell scripting
Bourne/bash shell scripts: case statement
The case statement is an elegant replacement for if/then/else if/else statements when making numerous comparisons. This recipe describes the case statement syntax for the Bourne shells (sh, ksh, bash, zsh, etc.).
Category Bourne shell scripting
Bourne/bash shell scripts: if statement syntax
Conditional expressions give programs life. The ability to branch makes shell scripts powerful. This recipe shows the basic if then else structure for sh, ksh, bash, zsh, etc.
Category Bourne shell scripting
Determine if a file is readable by current Bourne shell script user
A well contructed shell script, like any good program, should handle error conditions gracefully. Checking if a file is readable before attempting to read it allows a script to branch instead of abort or display an error message.
Category Bourne shell scripting
Determine if a file is writable by a Bourne script user
From a Bourne shell script (sh, ksh, bash, …), it is possible to test if a file exists and is writable by the user running the script.
Category Bourne shell scripting
Determine if file exists in a Bourne/bash shell script
Category Bourne shell scripting

