Re: [GENERAL] [SQL] bash & postgres

2009-03-23 Thread Tom Lane
Erik Jones writes: > On Mar 23, 2009, at 7:05 AM, Tom Lane wrote: >> The reason you have to do this is that psql doesn't recognize >> backslash commands in a -c string. There's a school of thought that >> doesn't want us to allow multiple commands in a -c string, even. > Hmm... Apparently it doe

Re: [GENERAL] [SQL] bash & postgres

2009-03-23 Thread Erik Jones
On Mar 23, 2009, at 7:05 AM, Tom Lane wrote: Erik Jones writes: On Mar 22, 2009, at 9:03 PM, Greenhorn wrote: How do I use \c (or any other psql commands beginning with a "\") in a bash script? For multi-line input to a psql call in a bash (or any decent shell) script, I'd use a here do

Re: [GENERAL] [SQL] bash & postgres

2009-03-23 Thread Tom Lane
Erik Jones writes: > On Mar 22, 2009, at 9:03 PM, Greenhorn wrote: >> How do I use \c (or any other psql commands beginning with a "\") in a >> bash script? > For multi-line input to a psql call in a bash (or any decent shell) > script, I'd use a here document: Or echo/cat the script into psql

Re: [GENERAL] [SQL] bash & postgres

2009-03-22 Thread Erik Jones
On Mar 22, 2009, at 9:03 PM, Greenhorn wrote: Hi, I'm trying to pass variables on a bash script embedded with psql commands. cat header.txt "to1","from1","subject1" "to2","from2","subject2" "to3","from3","subject3" "to4","from4","subject4" cat b.sh #!/bin/bash two="2" psql -h localhost