TCL script
set ::env(foo) "bar"
bash script
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. What am I doing wrong?
If your bash script contains something like this (let's call it showenv
)
#! /bin/bash
echo $foo
and your tcl
#! /usr/bin/tclsh
set ::env(foo) bar
exec ./showenv >>& /dev/tty
then, showenv
will show
bar
that is, the tcl script sets the environment for its children processes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.