Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Apr 2003 18:54:22 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Raphael Marmier <raphael@computer-rental.ch>
Cc:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: can't set a variable with a dash in its name!!
Message-ID:  <20030427235420.GC22259@dan.emsphone.com>
In-Reply-To: <B4D3860B-7907-11D7-A8A8-000393D67E4A@computer-rental.ch>
References:  <B4D3860B-7907-11D7-A8A8-000393D67E4A@computer-rental.ch>

next in thread | previous in thread | raw e-mail | index | archive | help
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# setenv WITH_COURIERIMAP
> re#
> 
> re# sh
> # export WITH_COURIER-IMAP
> export: WITH_COURIER-IMAP: bad variable name
> # export WITH_COURIERIMAP
> #
> 
> 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
expansion:

    ${parameter:-word}
        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
    unset.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030427235420.GC22259>