Return status from expect to csh script

  • Follow


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

0
Reply nergal (18) 7/13/2007 7:59:29 AM

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.
0
Reply ppluzhnikov-nsp (516) 7/13/2007 2:01:51 PM


1 Replies
89 Views

(page loaded in 0.04 seconds)

Similiar Articles:













7/25/2012 8:24:13 AM


Reply: