title: Open Vim from within a Bash shell script
body: <p>I want to write a Bash shell script that does the following:</p>
  <ol>
  <li>Opens a file using Vim;</li>
  <li>Writes something into the file;</li>
  <li>Saves the file and exits.</li>
  </ol>
  <pre><code>echo 'About to open a file'
  vim file.txt  # I need to use vim application to open a file
  # Now write something into file.txt
  ...
  # Then close the file.
  ...
  echo 'Done'
  </code></pre>
  <p>Is that possible? I found something called Vimscript, but not sure how to use it.
  Or something like a here document can be used for this?</p>
  <p><strong>Update:</strong> I need to verify that Vim is working fine over our file
  system. So I need to write script that invokes Vim, executes some
  command, and closes it. My requirements do not fit into doing stuffs
  like <code>echo 'something' &gt; file.txt</code>. I got to open the file using Vim.</p>