Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,我想使用登录时定义的 $USER 和 $HOSTNAME。然而
set g_user [exec echo \$USER]
仅向我显示 \$USER 无法识别的错误。
该env数组是您需要的:
env
# if you use env in a procedure, you need to specify it is a global variable global env set g_user $env(USER)
记录在http://tcl.tk/man/tcl8.5/TclCmd/tclvars.htm