| ## 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 dcecp> You can avoid some parsing problems by placing braces around the arguments as in dcecp> eval {$a $b $c} dcecp> To make certain the dcecp parses your eval command correctly, you can invoke dcecp's list command to generate a valid list structure: dcecp> eval [list $a $b $c] dcecp> ##