Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Rudy Fernandes — — source: Informix-list mailing list archive (1991-1998)
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
-----------------------
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.