cc: [EMAIL PROTECTED] 
Subject: Re: [ast-users] ksh/tcsh and variables with hyphen in name
--------

> Hello,
>   I'm having problem with tcsh/ksh interaction:
> tcsh allows an environment variable to contain a hyphen in its name, so the
> following would work in tcsh:
> 
> setenv a-b foo
> 
> However when starting ksh from tcsh such a variable is not visible in ksh's
> environment and it is not passed on when e.g. starting another tcsh instance
> from ksh.
> 
> My question is: shouldn't be such variables tolerated in the environment?
> 
> Thanks in advance for the answer.
> 
> -- 
> Tomáš Smetana
> Sr. Software Maintenance Engineer, Red Hat
> RH IRC: #brno #devel #base-os #seg-team; Freenode IRC: #fedora-devel
> 

A C program can put any arbitrary string into the environment list and
the shell must be guarded to be able to ignore strings that it doesn't
recognize.

The POSIX standard seems to be vague about how the shell should handle these.
In section 2.3 it says that it should mark for export variables
from the environment.  I believe that the shell is only supposed to
export variables with the export attribute and assignmet variables
that precede a command.

Since variables that are not valid cannot be marked for export, they
are not included.

However,  you might ask for an interpretation on this by the POSIX
standards.  YOu might also want to check to see what zsh and ash do
as well.  If all the other shells pass these along, and it does
not violate the POSIX standard, then it would be easy for the shell
to remember these when the environment is read and add them to
the for every command that is executed.


David Korn
[EMAIL PROTECTED]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to