<p>Consider the Bash code:</p>
<pre><code>function dropMyDB() {
  kubectl -n $1 exec -ti $1-CLUSSTER-0 -- psql -d MYDBNAME -U postgres -c &quot;truncate table &quot;$2&quot;;&quot;
}

dropMyDB $1 &quot;myTableNameInCamelCase&quot;
</code></pre>
<p>When I execute the code it produces:</p>
<pre><code>ERROR:  relation &quot;mytablenameincamelcase&quot; does not exist
command terminated with exit code 1
</code></pre>
<p>Which means that the table name is not passed in its CamelCase form.</p>
<p>How can we fix this ?</p>

JAN
<h3>First</h3>
<p>Escape your <code>&quot;$2&quot;</code> because it is inside another double quote</p>
<pre class="lang-bash prettyprint-override"><code>postgres -c &quot;truncate table &quot;$2&quot;;&quot;

# to
postgres -c &quot;truncate table $2;&quot;

# or
postgres -c &quot;truncate table \&quot;$2\&quot;;&quot;
</code></pre>
<h3>Second</h3>
<p>You can test that the issue is not <a href="/questions/tagged/bash" class="post-tag" title="show questions tagged &#39;bash&#39;" rel="tag">bash</a></p>
<pre class="lang-bash prettyprint-override"><code>function dropMyDB() {
  echo &quot;kubectl -n $1 exec -ti $1-CLUSSTER-0 -- psql -d MYDBNAME -U postgres -c \&quot;truncate table \&quot;$2\&quot;;\&quot;&quot;
}

dropMyDB $1 &quot;myTableNameInCamelCase&quot;
</code></pre>
<p>Then</p>
<pre class="lang-bash prettyprint-override"><code>chmod +x script.sh

./script.sh foo
kubectl -n foo exec -ti foo-CLUSSTER-0 -- psql -d MYDBNAME -U postgres -c &quot;truncate table &quot;myTableNameInCamelCase&quot;;&quot;
</code></pre>
