Обсуждение: examples of psql in shell script

Поиск
Список
Период
Сортировка

examples of psql in shell script

От
Pam Wampler
Дата:
I am trying to run a shell script & pass variables from the shell script to
psql & get the following error --
does anyone have examples (I have read through the documentation & can't
seem to get it right)  thanks

this is my script cp.sh
#!/bin/sh
echo $1;
table1=$1;
echo $table1;
psql -c '\copy $table1 from 'fileout'' test


this is what i get when I run  sh -x./cp.sh  employees

ERROR:  Relation ':table1' does not exist
\copy: ERROR:  Relation ':table1' does not exist