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

From: Ennio-Sr <nasr(dot)laili(at)tin(dot)it>
To: novice(at)postgresql(dot)org
Subject: psql: Is it possible to run a query from a *sql file?
Date: 2005-05-01 01:30:45
Message-ID: 20050501013045.GA28462@deby.ei.hnet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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) ]

Browse pgsql-novice by date

  From Date Subject
Next Message tövis 2005-05-01 14:14:08 CONSTRAINT ... FOREIGN KEY
Previous Message Volkan YAZICI 2005-04-30 21:07:38 connection status and lo