Re: Pesky informational messages in dbaccess
Posted in 1997
In article <5lqqtv$rs@cssun.mathcs.emory.edu>,
cdr@xteam.co.at (Chris Drauch) wrote:
>Jacob Salomon wrote
<snip>
>>oubliette
Thanks for the nugget, Billy. (Going to use it in my next letter to
the in-laws)
>#!/bin/sh
>SQL="select tabid from systables"
>TMPF=/tmp/dbaccess.$$
>
>dbaccess xteam - >$TMPF 2>/dev/null <<%%
>$SQL
>%%
I find that error messages do not got to $TMPF (Dec-unix 3.2 OL7.2).
However if I change the script to
..
SQLFILE=$1
ERRF=/tmp/errordb.$$
dbaccess - $SQLFILE > $TMPF 2>$ERRF ....etc
errors are stored in $ERRF for display "if [ $? != 0 ]"
>
>if [ $? -ne 0 ]
>then
> echo "ERROR:"
> head -n 2 $TMPF
>else
> echo "Your results:"
> NRLINES=`wc -l $TMPF | cut -c 1-7`
> TLINES=`expr $NRLINES - 4`
> HLINES=`expr $TLINES - 1`
> tail -n $TLINES $TMPF | head -n $HLINES
You could put headers in your SQL statement so that the else
clause just has "more $TMPF".
HTH.
-----------------------
Rudy Fernandes
GIC, Kuwait
OL 7.20UC4, 4GL 6.04UC1
-----------------------