title: Pass commands to Mongo shell from bash script without halting interactive Mongo shell
body: <p>I am looking to create a bash script which connects to a remote Mongo database and initializes an interactive Mongo shell, issues a couple of commands to the interactive Mongo shell, and then enables the interactive shell to continue running so that I can continue entering commands into it.</p>
  
  <p>Currently, I understand that I can connect to a Mongo database and issue a command to it within a bash script like so:</p>
  
  <pre><code>mongo &lt;ip&gt;:&lt;port&gt;/&lt;database&gt; --eval "db.auth('myuname', 'mypass');"
  </code></pre>
  
  <p>However, I would like my bash script to run the above command, and then keep the Mongo shell that was initialized running so that I can continue to use it and enter commands into it on my own. It seems that after running the above command, a Mongo shell is created and then halted immediately after the given <code>db.auth()</code> command is executed, but I would like to keep the shell running past this point.</p>