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

Raphael Marmier raphael at computer-rental.ch
Mon Apr 28 14:26:55 PDT 2003


thanks again!

Unfortunatly that doesn't seem to fix. It looks like the way we set the 
variable doesn't help it, it just gets ignored one way or another.
Removing the dash in all instance of the variable in the Makefile 
worked. It looks like a variable is a variable, even when set from 
within make.

After a bit of looking around, it looks like only csh and tcsh wheren't 
compliant and allowed dashes.

Raphael

Le lundi, 28 avr 2003, à 01:54 Europe/Zurich, Dan Nelson a écrit :

> 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 at allantgroup.com
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to 
> "freebsd-questions-unsubscribe at freebsd.org"



More information about the freebsd-questions mailing list