Combining control structures

You can combine control structures by nesting (that is, putting one inside another). For example:
for file in $(find . -name "*.c" -print)
do
    if test $file -ot $1
    then
        echo $file
        c89 -c $file
    fi
done

This shell script takes one positional parameter, giving the name of a file. The script looks in the working directory and finds the names of all .c files. The if control structure inside the for loop tests each file to see if it is older than the file named on the command line. If the .c file is older, echo displays the name, and the file is compiled. You can think of this as making a set of files up to date with the file name specified on the command line.

For more information about the test command, see the test command description in z/OS UNIX System Services Command Reference. The section in the sh command description that discusses reserved-word commands contains information about the [[ ... ]] form.