Re: dbaccess fail status to Bourne shell exit status
Posted in 1999
It appears that dbaccess was written to conform to UNIX exit code conventions.
In the case of "drop table sometable", if dbaccess succeeds in dropping the
table it exits with 0; if it fails to drop the table it exits with 255. So the
following shell script fragment would do what you want:
-----------------------------------------------------------------------
dbaccess somedatabase >somelogfile 2>&1 <<-!
drop table sometable!
if [ $? -eq 0 ]
then
echo sometable was dropped
else
echo failed to drop sometable
fi
--------------------------------------------------------------------
In article <3720ee13.15348198@news1.ibm.net>,
roach@NOSPAMportalinc.com wrote:
> Hi folks
>
> I want to invoke dbaccess through a Unix script and drop a table. If
> the table does not exist, I want the Unix script to report this using
> $?. dbaccess just executes a sql file with a single drop statement.
> Any ideas?
>
> TIA
>
> Steve
>
> ---------------------------------------------------------
> Steve Roach: Remove NOSPAM from address to reply:
> steve_roach@NOSPAMibm.net
> steve_roach@NOSPAMhotmail.com
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own