Hello all,

I'm currently learning postgresql under unix systems.
I have still some questions about it...because I don't find any documentation about how to use postgreSQL in shellscripts neither using it with external .sql style files.

1/ isn't it existing a "SPOOL" subcommand like in oracle ?
Code:
SPOOL ../log/foo.bar.log
....
SPOOL OFF
2/ how to use shell scripts variables ?

actually I use something like that

a shell-script-----calling---->SQL file----using---->shellcommand

is it possible to do like

a shell-script----calling---->SQL file-----using---->parameters ?

for example :
Code:
#!/bin/sh
toto=4
psql -qf foo.sql -o foo.log
inside the sql file I do :
Code:
...\set toto \! '\\''`echo $toto`'\\''
to get toto's value

thanks for the help

(If you have some very good links to documentation about programming postgreSQL inside shellscripts and external .sql file, please give them all)

Regards