Something I often do (and I'm hoping other folks do too) is write a script and run it through a interpreter.
Since I try to use org mode and org babel for scripting and literate programming, I end up with
#+BEGIN_SRC sh :results output replace cat << EOF | psql SELECT id,name FROM CUSTOMERS ORDER BY id; EOF #+END_SRC
All I have to do is C-c C-c and I have immediate results.
Sometimes it's a snippet of ruby code - piped to the 'bundle exec rails console' command, similar technique as above psql example.
My problem is, it hard to write anything substantial inside the "heredoc" block above because
emacs thinks I'm writing bash, when I'm writing sql emacs thinks I'm writing bash, when I'm writing ruby
This means I loose syntax coloring, smart indentation, etc of the ruby/sql mode. In -nw mode (prelude) bash "herodocs" have a really low-contrast color, making the code I'm writing really hard to see.
I'm guessing a lot of people write code blocks in org mode that are eventually piped to an interpreter for quick feedback based development. So whats the best way to go about doing this?