Common Desktop Environment: Desktop KornShell User's Guide

Immediate Return Value

Many of the category 3 commands return a single value using an environment variable specified as the first parameter to the command (for these special commands, the first parameter has the name variable). If this return value is immediately used in an expression, the special environment variable "-" may be used in place of a variable name. When dtksh encounters "-" as the name of the environment variable in which the return value is to be returned, it instead returns the result as the value of the command. This allows the shell script to embed the command call in another command call. This feature only works for commands that return a single value, and the value is returned in the first parameter. For example:

XtDisplay DISPLAY $FORM 
XSync $DISPLAY true

can be replaced by the equivalent statement:

XSync $(XtDisplay "-" $FORM) true

The reference to $DISPLAY is replaced with the value returned by the call to XtDisplay.

This capability is available for all category 3 commands except those that create a widget, those that return more than a single value, and those whose first parameter is not a named variable. Commands that do not accept "-" as the environment variable name include the following: