var

var


Unix Files Index Level gfe
Syntax
Category Definitions
Type Definition
Description an OSFI driver providing access to TCL shell variables.

The var driver (most easily used via the "var" file in the "dm" account) provides access to TCL shell variables via a file interface.

A read using the variable name as the item id returns the shell variable's contents.

A read using a TCL command surrounded by back-quotes executes the TCL command and returns the results as if those results had been stored in an item.

A write using the variable name as the item id is identical to doing a TCL "set" on that variable.

A delete using the variable name as the item id is identical to doing a TCL "unset" on that variable.

A select/readnext loop is similar to the TCL "penv" command except that only the variable names are returned.  Note that only user-defined variables are returned by the select.  Preset and system variables can only be queried by doing a direct read.
Options
See Also osfi @ penv set unset var
Example open "var"
*
* Read a shell variable
*
print @user
*
read xx from "user"
print xx
*
*
* Write a shell variable
*
execute "set myvar=abc"
*
write "abc" on "myvar"
*
* Delete a shell variable
*
execute "unset myvar"
*
delete "myvar"
*
* Display a list of user variables
*
execute "penv"
*
select
loop
 readnext id then print id else exit
repeat
*
*  Execute a tcl command
*
execute "display @`who`"
*
read xx from "`who`"
print xx
Warnings
Compatibility D3 7.0
Unix Files Index Level gfe