Embed tcl in ksh93 script

Hello everyone,
I am trying to embed some tcl code inside a ksh93 script but I am not having any success.
I even tried the simplest of code, something like this:

.
.
jk=$(echo $(tcl << |
write_file junkme "test"'
|
))

just to see if a file gets written. When I run there are no errors, but I am not getting the file.
Am I doing something wrong with the embedding format?
If I interactively place this code inside a ksh93 session, one line at a time it works ....
Please help me resolve this.
When I get over this first hurdle then I will actually be putting more realistic statements inside my embedded tcl area.
Is there maybe a better way to go by for embedding snippets of tcl code in ksh93 scripts?
Thanks to all.:slight_smile:

Maybe tcl reads /dev/tty not stdin/fd 0. Never used | for <<. Run strace/truss/tusc and see what really happened.

$(echo ...) only re-arranges lines to words.
A mark | might be mistreated by some shells.
Try

jk=$(tcl << EOTCL
write_file junkme "test"
EOTCL
)

Might be happier in tclsh: Man Page for tclsh (all Section 1) - The UNIX and Linux Forums