If you're using ksh93, consider using nameref and get the benefits of
call by reference:
function MyFunc
{
typeset argInput="$1"
nameref argResult=$2
...
argResult='a value'
return 0
}
...
Result=
MyFunc Input Result
if [[ $Result == whatever ]]
...
And if you really want to have fun, make Result a compound variable
if you have several values to return. :-)
Regards,
Mario DeFazio
On 12/24/2009 6:43 PM, Cyrille Lefevre wrote:
Eric Peterson a écrit :
As for getting the proper $? return code. I am guessing that since
the sub-process successfully finished (regardless of any exit code
sqlplus may send) it will always be 0. So I like idea of putting my
code into a function, then grep -c for ORA-/PLS-/TNS-/... and then
set a return code to the calling routine with the output on STDOUT or
STDERR as needed.
didn't see it before, but you have to do the trick in 2 pass,
declaring the variable, the affecting it a value such as :
typeset rv=
rv=$(...)
rc=$?
instead of :
typeset rv=$(...)
rc=$?
or rc get the typeset rc and not the subshell one, so rc is always 0 !
Regards,
Cyrille Lefevre
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users