On 26/07/09 20:07, Matt Wozniski wrote:
>
> On Sun, Jul 26, 2009 at 11:34 AM, Efraim Yawitz<[email protected]>
> wrote:
>>
>>
>> On Sun, Jul 26, 2009 at 6:20 PM, Gregory Margo<[email protected]> wrote:
>>>
>>> No. Shells in general (bash,dash,ksh,zsh,tcsh,csh) allow complete
>>> removal of the environment variable. Bourne-type shells use "unset"
>>> and C-type shells use "unsetenv" commands.
>>>
>> OK, but why is that necessary?
>
> For programs that have different behavior depending on whether or not
> a given environment variable exists - there are a great many programs
> that fall into this category. For instance...
>
> $ export PAGER='echo hello'
> $ man man
> hello
> $ PAGER=
> $ man man
> <... implicitly paged as though by 'cat' ...>
> $ unset PAGER
> $ man man
> <... implicitly paged through 'more' ...>
>
> So, you get different behavior for a non-empty environment variable,
> an empty environment variable, and no environment variable.
>
> ~Matt
I think we're up against a culture difference here. On Dos/Windows,
setting an environmant variable to the empty string, e.g. by
SET SOMESTUFF=
actually removes it, and to test if it exists, you check it against the
empty sring, e.g;
IF x%SOMESTUFF% == x GOTO SOMESTUFFERROR
GOTO SOMESTUFFON
:SOMESTUFFERROR
ECHO SOMESTUFF undefined
GOTO FINISH
:SOMESTUFFON
...
...
:FINISH
On Unix, it's not the same: you can set an environment variable
explicitly to the empty string, e.g. (with bash)
export SOMESTUFF=''
and that's not the same as having it unset.
Best regards,
Tony.
--
The confusion of a staff member is measured by the length of his
memos.
-- New York Times, Jan. 20, 1981
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---