OSF DCE Administration Guide--Core Components

OSF DCE Administration Guide—Core Components
Patterns can include wildcard characters. A ? (question mark) in a search pattern
matches any single character in the target pattern. For instance, ?at matches bat and hat.
A * (asterisk) in a pattern matches any string in the target pattern. For instance, *at
matches both bat and "three cornered hat" (note the use of quotes to disable spaces as
separators).
You might want a way to execute some default script when no pattern matches are found.
The case command has a special pattern called default whose corresponding script
executes when no pattern match is found. You should place the default pattern as the last
position in the list:
case $x in {
a {puts "script for case a"}
b {puts "script for case b"}
default {puts "run this script if no matches are found"}
}
2.10 Creating Commands Dynamically
The eval command lets you create scripts as you go along by chaining smaller scripts
together. This technique could be useful in a script that records administrator responses
to various questions and then constructs a specialized script based on those responses.
The syntax is
eval arg ... arg
The following example uses variables to hold options and their values for an account
create operation. The eval command ensures that the variables expand and execute
properly.
dcecp> set mpwd {-mypwd mxyzptlk}
-mypwd mxyzptlk
dcecp> set pwd {-password change.me}
-password change.me
dcecp> set org {-organization guests}
-organization guests
dcecp> set grp {-group guest}
-group guest
dcecp> eval account create guest1 $mpwd $pwd $org $grp
dcecp>
Be careful when using variables to construct eval commands. An eval command like the
following can sometimes cause problems within scripts because dcecp parses it twice.
First, dcecp parses the eval command and its arguments. Then it again parses the eval
arguments when they’re executed as scripts.
dcecp> eval $a $b $c
2 22 Tandem Computers Incorporated 124243