A. Van Hook writes:

> #!/usr/bin/expect
>
> set query [lindex $argv 0]
> set query [lindex $argv 1]
>
> spawn psql imdb -U hook -n
>           expect "Password: ";
>           send   "$passwd\n ";
>           expect "imdb=# ";
>           send   "$query;\r";
>           expect "imdb=# ";
>           send   "\q;\r";
>
> The problem is that long query returns  invoke the paging option  so you
> can scroll a page a time. Paging doesn't work  properly within the
> script and even if it did , I would have to disable it in order to
> redirect the output to a file or a pipe.

Try psql -P pager to turn the pager off.  Also you can probably use

export PGPASSWORD=xyz
psql ...

to skip the password probe.

-- 
Peter Eisentraut      [EMAIL PROTECTED]       http://yi.org/peter-e/


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to