Perl and PHP do this with backticks. For example,
$output = `ls`;
Returns a directory listing. A similar function, system(\"foo\")
system(\"foo\")
Clozure Common Lisp:
(with-output-to-string (stream) (run-program "ls" '("-l") :output stream))
LispWorks
(with-output-to-string (*standard-output*) (sys:call-system-showing-output "ls -l" :prefix "" :show-cmd nil))