OSF DCE Administration Guide--Core Components

Using the DCE Control Program Command Language
dcecp>
You can avoid some parsing problems by placing braces around the arguments as in this
example:
dcecp> eval {$a $b $c}
dcecp>
To make certain dcecp parses your eval command correctly, you can invoke the dcecp
list command to generate a valid list structure:
dcecp> eval [list $a $b $c]
dcecp>
2.11 Reading Other Files as dcecp Scripts
The source command reads the contents of other files, executing them as dcecp scripts.
This capability lets you construct higher level scripts by plugging lower level functions
together—like building blocks. Because you reuse your scripts rather than duplicate
them with potential variations, scripts are more consistent and easy to develop and
maintain. The command syntax is
source filename
The return value from source is the return value from the last command in filename.
As a practical example, imagine we have one script that lists entries in CDS subtrees,
another script that deletes subtrees, and another script that moves subtrees. One common
function needed by all these scripts might be to list every child directory under the root
of the subtree. You could write a script that lists every child and name it something like
children_list.dcp. (The .dcp extension is a dcecp convention for naming script files.)
When any of your scripts need to list all the child directories, simply use the source
command:
source children_list.dcp
Terminate a source command by using the return command. The return command
provides a way for commands like source and proc to exit in a controlled manner, even
when expected or unexpected error conditions occur. Rather than allow error conditions
to cause the whole script to exit and fail, the return command manages error information
and allows the script to continue executing. We discuss the use of return with other
error-handling techniques in Section 2.14.
124243 Tandem Computers Incorporated 2 23