IMPORTAS(1)

NAME
importas - replace a literal with the value of an environment variable, then execute another program

SYNOPSIS
importas [-i | -D default] [-u] [-s] [-C | -c] [-N | -n] [-d delim] variable envvar prog...
importas -S [-i | -D default] [-u] [-s] [-C | -c] [-N | -n] [-d delim] envvar prog...

DESCRIPTION
importas fetches the value of envvar in the environment. If neither the -D nor the -i option is given, and envvar is undefined, no word is returned (that is different from the empty word).

importas then performs variable substitution ( cf. execline-substitute(7)) on prog..., with variable as key and that string as value.

importas then exec(3) s into the modified prog....

When envvar is undefined, and the -D option is not given, any variable substitution ( cf. execline-substitute(7)) with variable as the key will return no word; that is true even when the ‘${variable}’ form to be substituted happens in the middle of a word (with a prefix and/or a postfix), which means the whole word will be deleted. If this is not the behaviour you want, use the -D option.

OPTIONS

-D default
    If this option is given and envvar is undefined, substitute default for the value of variable instead of no word. For instance, to substitute the empty word, use ‘-D ""’.

-i  Insist. If envvar is undefined, importas will not do anything; instead, it will exit 100 with an error message. This has precedence over any -D option.

-u  Unexport. envvar will be removed from the environment after the substitution. ‘importas -u variable envvar’ is equivalent to ‘importas variable envvar unexport envvar’.

-S  Import with same name. This option allows variable to be omitted; it will be the same as envvar. In other words, ‘importas -S var’ is the same as ‘importas var var’.

Other options are used to control the substitution mechanism ( cf. execline-transform(7)).

SEE ALSO
define(1), elgetpositionals(1), elglob(1), multidefine(1), multisubstitute(1), exec(3), execline-substitute(7), execline-transform(7)

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/importas.html

AUTHORS
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)