Hi all,
I have to execute a unix cshell script inside my TCL script and then read its return code. The cshell script return codes can be:
0 - 100 % success
1 - partial success
2 - error
The dummy cshell script named "dummy_script.sh" is below:
-------------------
#!/bin/ksh
echo Cshell SCRIPT FILE Execution!
exit 2
----------------
I tried the following code in my TCL program but it only recognizes return codes 0 or 1 (not 2 per example):
------------------------
if { [catch {exec dummy_script.sh} errorCode] != 0} {
puts "returned non zero value!"
# now I want to print the errorCode (which should be 2)
puts $errorCode
} else {
puts "returned zero value!"
}
-----------------
When the line "puts $erroCode" is reach the output is
"child process exited abnormally". I expected the output as 2.
Can anybody help me to figure out how to retrieve the correct return code?? Thanx!
BTCMan
I have to execute a unix cshell script inside my TCL script and then read its return code. The cshell script return codes can be:
0 - 100 % success
1 - partial success
2 - error
The dummy cshell script named "dummy_script.sh" is below:
-------------------
#!/bin/ksh
echo Cshell SCRIPT FILE Execution!
exit 2
----------------
I tried the following code in my TCL program but it only recognizes return codes 0 or 1 (not 2 per example):
------------------------
if { [catch {exec dummy_script.sh} errorCode] != 0} {
puts "returned non zero value!"
# now I want to print the errorCode (which should be 2)
puts $errorCode
} else {
puts "returned zero value!"
}
-----------------
When the line "puts $erroCode" is reach the output is
"child process exited abnormally". I expected the output as 2.
Can anybody help me to figure out how to retrieve the correct return code?? Thanx!
BTCMan