varsub.icn: Procedure to perform UNIX-shell-style substitution

link varsub
November 2, 1995; Robert J. Alexander
This file is in the public domain.

Variable values are obtained from the supplied procedure, "varProc",
which returns the value of its variable-name argument or fails if
there is no such variable.  "varProc" defaults to the procedure,
"getenv".

As with the UNIX Bourne shell and C shell, variable names are
preceded by $.  Optionally, the variable name can additionally be
surrounded by curly braces {}, which is usually done when necessary
to isolate the variable name from surrounding text.

As with the C-shell, the special symbol ~<username> is handled.
Username can be omitted, in which case the value of the variable
"HOME" is substituted.  If username is supplied, the /etc/passwd file
is searched to supply the home directory of username (this action is
obviously not portable to non-UNIX environments).

Source code | Program Library Page | Icon Home Page