title: Psql finds path when connected to the database but not when running command with -c
body: <p>I'm trying to loop through a directory, copying all the json files into my PostgreSQL database. As I copy them, I must replace any \ with \\ so that Postgres can properly parse it.</p>
  <p>When I run:</p>
  <pre><code>$ psql -p 30001 my_database
  my_database=#\copy my_jsons from program 'sed ''s/\\/\\\\/g'' &lt; /home/postgres/jsons.json';
  </code></pre>
  <p>This command works fine and properly inserts the data into the table.  However, since I have multiple files I need to copy, I am trying to loop through a directory and insert using:</p>
  <pre><code>$ psql -p 30001 my_database -c &quot;\copy my_jsons from program 'sed ''s/\\/\\\\/g'' &lt; /home/postgres/jsons.json';&quot;
  </code></pre>
  <p>Using this command, sed starts acting differently and I get the error:</p>
  <pre><code>sed: -e expression #1, char 8: unterminated `s' command
  </code></pre>
  <p>Does anyone know why sed acts differently while using it in this way, and what I can do to get my desired result?</p>