How to use Fastexport exit codes in UNIX Shell Script

Analytics
Enthusiast

How to use Fastexport exit codes in UNIX Shell Script

Hi,

In my shell script I am using BTEQ, which is doing Fastexport. I will get two return codes. One from BTEQ and another from Fast Export. I want to use the Fast Export Return code in my Unix script to do the further processing.

I found that return codes automatically stores in $? and we can use that. but it is not working.

If RC !=0 then

do not merge the files

else

merge the files

fi

Thanks,

Terankit

2 REPLIES
Enthusiast

Re: How to use Fastexport exit codes in UNIX Shell Script

Anyone??? Is this the right place to ask this question or should I ask this in any UNIX forum?

Thanks,

Terankit

Supporter

Re: How to use Fastexport exit codes in UNIX Shell Script

Hi, I think you will find in unix / linux forums more valuable answers.

But you need to do something like

#!/usr/bin/ksh

LOG=./thisDBSetupRun.log

bteq < your_code.btq >>$LOG 2>&1
RC=$?

echo "STATUS: $RC" >>$LOG

if [ $RC != 0 ]; then
echo "End with ERROR. ($RC)" >>$LOG
exit;
fi