1 #!/bin/sh
 2 #*********************************************************************
 3 # Processing objects by calling a subroutine                         *
 4 #*********************************************************************
 5 
 6 rmmk()
 7 {
 8 hdisk="$1"
 9 addr="$2"
10 scsi="$3"
11 
12 echo "\nprocessing hdisk$hdisk at SCSI address $addr on $scsi"
13 rmdev -dl hdisk$hdisk
14 mkdev -c disk -t $type -s scsi -p $scsi -w $addr,0 -l hdisk$hdisk
15 
16 } # End of subroutine rmmk
17 
18 type="4500mb16bitde"
19 
20 #Cmd hdisk  addr   scsi
21 rmmk  2      2    scsi2
22 #rmmk  4      0   vscsi1
23 rmmk  12     3   vscsi3                                            #01
 | 
As written this script must be edited for any changes in the commands or the list of subroutine calls.
One difference from external commands is that the environment variables are available to and can be modified by the subroutine.
Line one has the standard #!/bin/sh to invoke the Bourne shell. Later examples may not all include this to save space.