Thread: psql: Is it possible to run a query from a *sql file?

psql: Is it possible to run a query from a *sql file?

From
Ennio-Sr
Date:
Hi all,
I'm wondering if it is possible to run a query from a .sql file;
something like this one:

------------
\! echo "insert key: ";read key; export $key;
SELECT autore, titolo, editore FROM bibl WHERE autore like '%[$key]%'
------------

Most likely the answer is 'no', as psql is an 'interactive'
application.
There seems to be no communication between the shell (where you digit
the key) and psql: the key vanishes somewhere ... ;(

Regards,
    Ennio

BTW: Somebody knows where does pgaccess store its queries?

--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.   \\?//
 Fa' qualche cosa di cui non sei capace!"  (diceva Henry Miller) ]    (°|°)
[Why use Win$ozz (I say) if ... "even a fool can do that.              )=(
 Do something you aren't good at!" (as Henry Miller used to say) ]