OSF DCE Administration Guide--Core Components
Using the DCE Control Program Command Language
9
Here we first set variable a to 7. In line 2, we use the expr command to add 2 to the
value of a (7). The dollar sign triggers dcecp to insert the value 7. The last line shows
the return value from the expr command.
A more relevant example might be
dcecp> set a /.:/sec
/.:/sec
dcecp> object show $a
{RPC_ClassVersion
{01 00}}
{RPC_ObjectUUIDs
{06 3b 23 00 72 e5 e0 1d 8c b4 00 00 c0 8a df 56}}
{RPC_Group
{2f 2e 2e 2e 2f 77 61 72 64 5f 63 65 6c 2e 6f 73 66 2e 6f 72
67 2f 73 75 62 73 79 73 2f 64 63 65 2f 73 65 63 2f 6d 61 73 74
65 72 00}}
{CDS_CTS 1994-05-23-17:21:37.481+00:00I0.000/00-00-c0-8a-df-56}
{CDS_UTS 1994-05-23-17:22:36.607+00:00I0.000/00-00-c0-8a-df-56}
{CDS_Class RPC_Group}
{CDS_ClassVersion 1.0}
dcecp>
Remove (undefine) a variable by using the unset command as in the following example:
dcecp> unset a
dcecp> set a
Error: can’t read "a": no such variable
dcecp>
2.3 Command Substitution
Command substitution provides a convenient way to express the return value of one
command within another command. This is useful when you want to use the return value
of one command as input to another command. Use brackets to invoke command
substitution. The following example uses the expr command, which we’ll discuss
shortly. Generally, expr performs a math function, returning the computed value
expressed by its arguments, as shown:
124243 Tandem Computers Incorporated 2−3