In tclsh, you should still have access to commands like ps and kill . I recreated your script loop and then went into a tclsh session:
$ tclsh % exec /path/to/loop.sh & 22267% ps PID TTY TIME CMD 19877 pts/0 00:00:00 bash 22212 pts/0 00:00:00 emacs-x 22317 pts/0 00:00:00 tclsh 22319 pts/0 00:00:00 loop.sh 22326 pts/0 00:00:00 sleep 22327 pts/0 00:00:00 ps % kill 22319 % ps PID TTY TIME CMD 19877 pts/0 00:00:00 bash 22212 pts/0 00:00:00 emacs-x 22317 pts/0 00:00:00 tclsh 22332 pts/0 00:00:00 ps
If you want to do this from a tcl script, here is a short example that shows the results of ps after the exec'ed process has been started, and then after it has stopped:
#!/usr/bin/tclsh set id [exec /path/to/loop.sh &] puts "Started process: $id" set ps [exec /bin/ps] puts "$ps" exec /usr/bin/kill $id puts "Stopped process: $id" set ps [exec /bin/ps] puts "$ps"
If your system has ps and kills in different directories, you will have to modify the script accordingly.
source share