title: Passing binding or arguments to ERB from the command line
body: <p>I have been playing around with erb from the command line recently. I wanted to make a dirt simple erb template, for example the following:</p>
  
  <pre><code>&lt;%- name = "Joe"; quality = "fantastic" -%&gt;
  Hello. My name is &lt;%= name %&gt;. I hope your day is &lt;%= quality %&gt;.
  </code></pre>
  
  <p>This works if I run</p>
  
  <pre><code>erb -T - thatfile.erb
  </code></pre>
  
  <p>what I want to do is to make <code>name</code> and <code>quality</code> be passable from command line arguments, so that I could do something like:</p>
  
  <pre><code>./thatfile.erb "Bill" "super"
  </code></pre>
  
  <p>from the bash prompt and do the same thing.</p>
  
  <p>I am aware that I could write a ruby script that would just read that template in and then use <code>ERB.new(File.read("thatfile.erb")).result(binding)</code>, or writing the template after an <code><strong>END</strong></code> and doing likewise, but I'm looking for a more lightweight approach if it exists, because I don't want to write two files for each erb script that I create for this purpose.</p>