Title: Bourne/bash shell scripts: if statement syntax Post by: Mark David on March 16, 2007, 01:33:58 PM 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. Code: if [ condition_A ] Multiple elif blocks can be strung together to make an elaborate set of conditional responses. |