Re: Suppressing output from ISQL statements and LOAD in ESQL
Posted in 1996
Kate Juliff wrote:
>
> I'm using ISQL vers 6.0 running under SCO UNIX 3.4. I have a UNIX script that
> calls an ISQL script that contains the statement
> LOAD FROM filename INSERT INTO tablename> I get the output "x rows loaded" which I want to suppress.
>
> So... I tried the -s option, and I still get the screen output.
> Then I tried redirecting the output from the UNIX script. Nogo.
>
> So I though I'd give up on this and write a short ESQL program to do the
> load. Unfortunately, "$load from filename insert into tablename
> works as expected in an ISQL script but brings up a systax error in ESQL
> As all I need to do is suppress output, can someone advise?
>
> Thanks in advance,
>
> Kate
Kate,
Maybe this can help:
#!/bin/sh
#########################################################
## my little load script: loadme.sh
##
db_name=$1
out_file=$2
in_file=$3
table=$4
if [ $# -lt 4 ] ; then
echo "usage: $0 db_name out_file in_file table"
exit
fi
isql -s ${db_name} 1>${out_file} 2>/dev/null <<+
LOAD FROM ${in_file} INSERT INTO ${table}
+
##
##
###################################################
OR:
Substitute the isql line for one of these:
isql -s ${db_name} 1>/dev/null 2>/dev/null <<+
isql -s ${db_name} >&- 2>/dev/null <<+
isql -s ${db_name} 1>/dev/null 2>&1 <<+
They all do the same thing, use either to totally
eliminate output, as you desired. If you use the
${out_file}, you could use /dev/null as an argument:
$ loadme.sh db_name /dev/null table
0 stdin standard input
1 stdout standard output
2 stderr standard error
>&- close stdout
<&- close stdin
2>&1 redirects stderr and stdout together, but can't redirect to file
unless 1 is set: 1>/dev/null 2>&1
If you use the C shell, >&file redirects stderr and stdout to file:
#!/bin/csh
isql -s ${db_name} >&/dev/null <<+
You may want to substitute /dev/null for a log file too.
Cheers,
Tim
\\\\|//
(6 6)
==============================---o00--(_)--00o---============================
Tim Schaefer http://www.shadow.net/~tschaefe
The Computer Business Company, Inc. tschaefe@shadow.net
=============================================================================