Search Postgresql Archives

Re: escape character for 'psql -c ' command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please include the list when replying.

On Tue, Nov 16, 2010 at 11:45 AM, Gary Fu <gfu@xxxxxxxxxxxxxx> wrote:
Short answer: for simple commands, you can use shell-escaping of a
double-quoted string.

psql -c "\\copy \"Table\" from 'text file'"


This works on sh, but I tried this syntax on tcsh, it fails:

11:38am 72 gfu@modular:~/sybase2postgres> psql -c "\\copy \"Table\" from 'text file'"
Unmatched ".

How to make it work on tcsh ?

Consult your shell's documentation. 

http://www.tcsh.org/tcsh.html/Lexical_structure.html

http://www.tcsh.org/tcsh.html/Special_shell_variables.html#backslash_quote

Apparently you can use "set backslash_quote=1" and then the original will work.  Read the warning above about backslash_quote:

Or use the long-version, which is pretty reliable.

Derrick

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux