title: Multiple mongo commands in kubernetes not working
body: <p>I am attempting to automate the following series of commands which work correctly into a BASH script:</p>
  
  <pre><code>kubectl exec -it mongo-pod -- bash
  mongo DBNAME
  db.auth("theUser", "thePw")
  db.theCollection.find()
  </code></pre>
  
  <p>The script I am using is as follows:</p>
  
  <pre><code>#!/bin/bash
  
  kubectl exec -it mongo-pod -- bash -c "mongo DBNAME &amp;&amp; /
  db.auth("theUser", "thePw") &amp;&amp; /
  db.theCollection.find()"
  </code></pre>
  
  <p>I have tried the following:
  <a href="https://stackoverflow.com/questions/43499313/executing-multiple-commands-or-from-a-shell-script-in-a-kubernetes-pod">Executing multiple commands( or from a shell script) in a kubernetes pod</a>
  but any commands that are added after the first using &amp; or &amp;&amp; are not executed. For example just using "mongo DBNAME" correctly opens the prompt and sets it to the correct db, but adding any other command with &amp;&amp; causes all commands to fail with the following:</p>
  
  <p>bash: -c line 0: syntax error near unexpected token 'theUser'</p>