title: Interpret and execute arbitrary Javascript in Linux CLI
body: <p>I've been looking for ways to do this for a while but haven't quite been able to find the right way to do it.</p>
  
  <p><strong>The task:</strong> Execute Javascript from a Linux command line.</p>
  
  <p><strong>For example,</strong> have the binary or whatever is going to interpret Javascript load up some .js files, then print a value of some variable.</p>
  
  <p><strong>More concrete example:</strong> I would like to get the final version of this page after Javascript has been interpreted and executed <a href="http://www.vureel.com/video/2809/American-Dad" rel="nofollow noreferrer">http://www.vureel.com/video/2809/American-Dad</a>. If you look at the page with Firebug, you will see that this obscure Javascript</p>
  
  <p><code>&lt;script language="JavaScript" type="text/javascript"&gt;/*&lt;![CDATA[*/var a,s,n;function a8bcb4f34dfd6e81cfdb9c115d1671582(s){r="";for(i=0;i&lt;s.length;i++){n=s.charCodeAt(i);if(n&lt;128){n=n ... etc ...&lt;/script&gt;</code></p>
  
  <p>turned into a nice embed code</p>
  
  <p><code>&lt;embed height="390" width="642" flashvars="file=http://vureel-cdn-2.vureel.com/leechingisillegal/537c69afbcaf4c7cf416f30077bbe9d1/4a29621d/here/2809.flv ...etc .../&gt;</code></p>
  
  <p>This is just an example but hopefully you see what I'm driving at.</p>