Saturday, January 2, 2016

(inconsistent?) behavior of environment variables

Tripped over the following on Linux & BSD:

bash$ echo $USER
tim
bash$ echo $UID
1000
bash$ vim
:echo $USER
tim
:echo $UID
:echo expand('$UID')
1000

Note that the ":echo $UID" didn't actually return anything. Yet
running it through expand() produced the expected result. I
confirmed the behavior to make sure that it wasn't some redraw issue,
using the expression register in insert-mode, inserting =$UID and
=expand('$UID') and got the same mismatched behavior.

Based on the description of "expr9" at ":help expression-syntax",
"$VAR" should contain that environment variable's content.

Is there something I'm missing here or reasoning for the difference?
Or documentation that I missed?

Thanks!

-tim



--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment