Emacs and Long Shell Commands
You can also use comint-run to execute a command without needing to start a sub-shell first. I believe M-x shell
uses comint mode with some modifications, so this won't be a whole lot different from that. But if you want to call a program directly and have its input and output be tied to a buffer, comint-run is the function to call. It is a little tricky to use, so read the documentation: C-h f comint-run
.