For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > July 2007 > Return status from expect to csh script









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Return status from expect to csh script
nergal

2007-07-13, 8:06 am

I have a csh script that executes an expect (TCL) script and I can't
get any return result from the expect script. Any ideas?

Here is a snippet of what I mean:
csh script:
--------------------
#!/bin/csh
@ returnStatus 0
expect script.tcl
@ returnStatus += $status
--------
tcl script:
------
<some tcl/expect code>
exit 1
-------

Even though I exit the tcl script with exit code 1 it will not be
catched by the csh script. The csh script works perfect if I instead
call another shell script of any kind.
I also tried to use "return 1" instead of exit in the expect script
but without correct status in the csh script.
(If I remember correctly it should be possible to use either exit or
return in expect?)

Cheers,
Nergal

Paul Pluzhnikov

2007-07-13, 10:05 pm

nergal <nergal@nergal.se> writes:

> I have a csh script that executes an expect (TCL) script and I can't
> get any return result from the expect script. Any ideas?


You have either mis-diagnosed the problem, or your 'expect' is broken:

[paul@amoeba ~]$ expect
expect1.1> exit 1
[paul@amoeba ~]$ echo $status
1
[paul@amoeba ~]$ echo "exit 42" > junk.tcl && expect junk.tcl; echo $status
42
[paul@amoeba ~]$ expect -version
expect version 5.39.0

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com