Hi, > OTOH, on Linux, after assigning the empty string, exists('$FOOBAR') > still returns 1, while ":unlet $FOOBAR" gives error E488: Trailing > characters. > > The classical way to test for "empty or undefined" is > > if ("X" . $FOOBAR) == "X" > > which, AFAICT, returns true even if $FOOBAR is undefined (i.e. has > never been set in this environment).
We can also test for "is set" with [[ -n ${FOOBAR+x} ]] && echo 1 or more simply with bash 4.2+ [[ -v FOOBAR ]] && echo 1 Anyway, the distinction becomes interesting as a few programs interpret the unset state as "use a default value", while an empty string really means an empty string. Given foo.c, and a properly configured gnumake (i.e. not MinGW make), the following will yield different results $> CC=clang make foo # prints: clang foo.c -o foo $> CC= make foo # prints: foo.c -o foo # and can't compile anything $> unset CC # just to assert the situation $> make foo # prints: cc foo.c -o foo This is the recurrent use case I run into that's behind the issue I've opened a while back. Regards, -- Luc Hermitte -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.