The Form and Menu Language

Backquoted expressions

Backquoted expressions may be coded as the value of a descriptor. They are evaluated at the time the descriptor is evaluated. When a backquoted expression produces output, it is considered part of the descriptor. This output must not produce an illegal value on the descriptor line. For instance, if the variable MYVAR is set to hello, then

   action=`echo $MYVAR`open menu Mymenu
will be equivalent to
   action=helloopen menu Mymenu

This produces an illegal descriptor value since helloopen is not a known FMLI command, and descriptors of type command must evaluate to a known FMLI command. As a result, the terminal will beep.

In addition to using backquoted expressions on descriptor lines, you can code them as ``stand-alone'' lines anywhere in menu, form, or text frame definition files. A stand-alone backquoted expression is one that starts a line, and it is evaluated when the frame definition file is opened, reread, or updated; before any descriptors are evaluated. Thus, if a stand-alone backquoted expression produces output to the message line, the output will appear before the frame being parsed is posted.

It is important to note that information can be passed to or from UNIX system executables and FMLI built-in commands using backquoted expressions. For example a menu item with the following definition of the action descriptor

   action=`date | message` nop
passes the output of the UNIX system date command to the FMLI built-in utility message, which displays it on the message line.

Using this feature of the Form and Menu Language, you can generate the entire contents of a frame dynamically at run time. For an example of a menu generated this way, see the regex(1fmli) manual page and ``Creating a dynamic menu''.

NOTE: In backquoted expressions, executables that expect standard input must be run via the run built-in utility. For example, if a user selects a menu item which has its action descriptor coded as action=`vi myfile`nop, the FMLI session will appear to hang. The same action, coded as action=`run vi myfile`nop, executes properly.

Expression operators

Several statements, utilizing FMLI built-in utilities or UNIX system executables, may appear inside a single backquoted expression, separated by one of the following operators:

NOTE: FMLI does not allow statement grouping by using parentheses, such as can be done in the UNIX shell, namely, statement1 && (statement2; statement3).

Next topic: File redirection
Previous topic: Quoting mechanisms

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004