can't set a variable with a dash in its name!!

Dan Nelson dnelson at
Sun Apr 27 16:54:30 PDT 2003

In the last episode (Apr 28), Raphael Marmier said:
> On a freshly installed 4.8, while trying to install the mail/imp3
> port, I realised that it was impossible to define the following
> variable, either in tcsh or sh:
> re# setenv WITH_COURIER-IMAP
> setenv: Syntax Error.
> re#
> re# sh
> export: WITH_COURIER-IMAP: bad variable name
> #
> I just tried on 4.6.2 and it works, as well as MacOSX.

Try "make WITH_COURIER-IMAP=yes", or "make -DWITH_COURIER-IMAP", or
edit the port Makefile or /etc/make.conf and set
"WITH_COURIER-IMAP=yes" in there.  Basically, that's not a valid shell
variable, so you have to set it from within make.

Posix says:

    Environment variable names used by the utilities in the Shell and
    Utilities volume of IEEE Std 1003.1-2001 consist solely of
    uppercase letters, digits, and the '_' (underscore) from the
    characters defined in Portable Character Set and do not begin with
    a digit. Other characters may be permitted by an implementation;
    applications shall tolerate the presence of such names.

The primary problem with the dash is that /bin/sh uses that in variable

        Use Default Values.  If parameter is unset or null, the
        expansion of word is substituted; otherwise, the value of
        parameter is substituted.

    In the parameter expansions shown previously, use of the colon in
    the format results in a test for a parameter that is unset or null;
    omission of the colon results in a test for aparameter that is only

	Dan Nelson
	dnelson at

More information about the freebsd-questions mailing list