[LGT] An example running on unix platform package require Expect # some commands to connect to a unix platform should be inserted here before send "cd /tmp\r" # wait for the command to end, wait for the prompt expect "\\$ " send "echo \$?\r" expect -re "(\\d+)" { set result $expect_out(1,string) } send_user "command exit with result code : $result" $ cd /tmp $ echo $? 0 $ command exit with result code : 0 [[can someone be a ''little'' more verbose? There is no $? variable... or echo command... in Tcl, right?]] echo $? is a shell command that will print the exit status of the previous shell command. [LV] 2007 Nov 09 I suspect that the original writer had in mind that this type of thing is pretty commonly encountered by shell programmers - particularly if they have to use rsh or other remote execution commands. The technique is that the writer of the code adds, to the shell commands being executed, commands to capture and then output the return code of the commands in question in a manner that could then be captured, parsed, and acted upon. I would code some sort of example in shell, but that isn't necessarily relevant. Basically, I create the scripts in a file, then do the remote execution of those scripts, and make certain that appropriate return codes are displayed. ---- !!!!!! %|[Category Expect]|% !!!!!!