Re: dbaccess, command line parameter
Posted in 2003
Hi Mitja:
Try something like this 'paso' file:
<SCREEN>
[cta@adela tmp]$ cat paso
#!/bin/bash
dbaccess nomi - <<!EOD
select empmnoem from emplmaes where empmcvee = $1!EOD
[cta@adela tmp]$ ./paso 40109
Database selected.
empmnoem ORTIZ,MU}OZ,FERNANDO
1 row(s) retrieved.
Database closed.
</SCREEN>
Note you need to modify the script to filter just the rows with the
information you need (awk, grep, etc), something like this
<SCREEN>
[cta@adela tmp]$ cat paso2
#!/bin/bash
dbaccess nomi - 2>&1 <<!EOD | grep empm
select empmnoem from emplmaes where empmcvee = $1!EOD
[cta@adela tmp]$ ./paso2 40109
empmnoem ORTIZ,MU}OZ,FERNANDO
</SCREEN>
HTH
----- Original Message -----
From: "Mitja Udovc" <mitja.udovc@mf.uni-lj.si>
To: <informix-list@iiug.org>
Sent: Friday, December 05, 2003 7:09 AM
Subject: dbaccess, command line parameter
> Hello!
>
> I would like to do following:
>
> in sql script file test.sql is:
>
> select * from $1>
> I would like to call this sql from command line and pass parameter into
it.
> like: cat test.sql|dbaccess db-test - .... ???parameter
>
> Mitja
>
>
sending to informix-list