1845592 Members
3451 Online
110246 Solutions
New Discussion

problem with su

 
cgzou
Occasional Advisor

problem with su

Hello all,
I had a problem like the following:
su informix <tbstat -d
if [ $? = 0 ] # problem here
then
...
fi
...
EOF

I could not get the exit code from $? for "tbstat -d" execution. Any idea will be appreciated!

Thanks and waiting for your reply.

cg
7 REPLIES 7
Domenico_5
Respected Contributor

Re: problem with su

hi

but are you sure that tbstat is executed? su without - don't read you eviroment (PATH for example)

bye
Dario_1
Trusted Contributor

Re: problem with su

cg

Try adding - between su and oracle.

DR
cgzou
Occasional Advisor

Re: problem with su

I did -x in my shell so I knew that tbstat -d was executed. $? was always 0 no matter failure or success. I guess it is sub shell problem.

Thanks
Dario_1
Trusted Contributor

Re: problem with su

Hi

SU to Informix and execute the command using the full PATH, then do an echo $? this will give you the exit status.

DR
cgzou
Occasional Advisor

Re: problem with su

DR,
It is not PATH issue, I executed the .profile before the tbstat(sorry didn't mention that in the ex.) and I also checked if it was actually executed, it did.

Anyway I tried your suggestion, didn't work.

Thanks
Domenico_5
Respected Contributor

Re: problem with su

mmm

I don't know informix, so tbstat in not a script corret?
you can use a workaround send the tbstat result on a file and check if it exist.

regards
Dario_1
Trusted Contributor

Re: problem with su

Hi again!!!

I don't know much about informix, can you tell me what tbstat does? Is this similar to onstat? Are you supposed to get any output like OFFLINE / ONLINE?

DR