1 Introduction
2 Interface
3 Scanner
4 Parser
5 Analyser
6 Tangle
7 Weave
8 Shell
9 Commands
10 Glossary
11 References

FunnelWeb Reference Manual

8.4 String Substitution

Most command shells provide some form of string substitution so as to provide some degree of parameterization. The FunnelWeb shell provides 36 different string variables named $0..$9 and $A..$Z (case insensitive). Each variable can hold a string containing any sequence of printable characters and can be as long as a command line.

The define command allows the user to assign a value to these variables. The define command takes two arguments. The first is the digit or letter of the variable to be defined. The second is a double quote delimited string being the string value to be assigned to the variable. If you want to include a double quote character within the string, you don't need to double it.


define 3 "/root/usr/dave/workdir/fwdir/testdir"
define M "/user/local/rubbish/bin/fw"
define Q "You don't need to double" double quotes"

Only the identifying character of the variable being assigned is used in the definition. This syntax is a simple way of preventing the variable from being substituted before it has a chance to be defined!

The following points clean up the remaining semantic details:

  • There is only one set of variables and they are global to all shellscripts. There are no local variables .
  • When a shellscript is invoked using the execute command, the substitution variables 0 through 9 are affected. See the EXECUTE command for more details.
  • If you want to include a dollar sign character in a command use "$$".
  • FunnelWeb also defines "$/" which translates to the character that separates directory and file name fields in file names on the host machine. For example: Sun="/", Vax="]", Mac=":", PC="\".
  • Substitution is not performed recursively.

Prev Up Next

Webmaster    Copyright © Ross N. Williams 1992,1999. All rights reserved.