Actually. I just added something similar to my emacs yesterday:
(defun sh-line ()
(interactive)
(let ((cmd (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
(end-of-line)
(newline)
(insert (shell-command-to-string cmd))))
(local-set-key (kbd "M-RET") 'sh-line)
With this Alt-RET will evaluate the last line in your shell, and insert the output.