eval in javascrip code example

Example 1: javascript execute string code

var theInstructions = "alert('Hello World'); var x = 100";

var F=new Function (theInstructions);

return(F());

Example 2: eval

Just use eval command for running string output. As for example:
eval $cmd   #execute command included in string value of $cmd variable
Or for a more sophisticated use run commands stored in lines of a file:
cat commands_file.txt | while read line; do eval $line; done