Operating Systems and Systems Integration

Shell Programming—an Introduction

Here are some example shell scripts for you to examine.

!/bin/sh echo -n ”input an integer (1 to 10): ” read INPUT VAR if [ INP UT V AR − le5]thenecho”inputlessthanorequalto5”elseecho”inputisgreaterthan5”fi

Figure 1: An example script showing use of the if statement

Nick Urbanik <nicku@vtc.edu.hk>  ver. 1.10