[英]How do I print TCL environment variable in my bash script
TCL script TCL 脚本
set ::env(foo) "bar"
bash script bash 脚本
echo ${env(foo)}
echo $foo
I am able to print the environment variable in the TCL script but for some reason I can't print the environment variable in my bash script.我可以在 TCL 脚本中打印环境变量,但由于某种原因,我无法在我的 bash 脚本中打印环境变量。 What am I doing wrong?
我究竟做错了什么?
If your bash script contains something like this (let's call it showenv
)如果您的 bash 脚本包含类似这样的内容(我们称之为
showenv
)
#! /bin/bash
echo $foo
and your tcl和你的 tcl
#! /usr/bin/tclsh
set ::env(foo) bar
exec ./showenv >>& /dev/tty
then, showenv
will show然后,
showenv
将显示
bar
that is, the tcl script sets the environment for its children processes.也就是说,tcl 脚本为其子进程设置环境。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.