DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Writing Deskshell commands

Using variables

In rule files, you can use variables to keep track of numbers and text strings. A variable name can consist of any sequence of letters, digits, and, underscores provided the first character is not a digit.


NOTE: Variable names beginning with two underscores should be avoided, as they are used in the standard rules. However, you can use names beginning with one underscore and then a letter or digit.

Variables do not have to be specially defined, and you can give them a value using an equals sign. For example, the following might specify a counter value for the subsequent repetition of a command:

   count=10


NOTE: There must not be any space on either side of the = sign.

For maximum flexibility, variables can be set to a list of values. The list is specified by putting all the elements of the list in brackets. So, for example, the following could be used to make the variable editors equal to a list of the filenames of all the editors on the system:

   editors=(vi xedit ed)

Variables are local to an executing script unless prefixed with a ``:''.


Next topic: Variable substitutions
Previous topic: Wildcards

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 26 May 2005