(lemacs.info)Single Shell

Next: Interactive Shell Prev: Shell Up: Shell

Single Shell Commands

   `M-!' (`shell-command') reads a line of text using the minibuffer
and creates an inferior shell to execute the line as a command.
Standard input from the command comes from the null device.  If the
shell command produces any output, the output goes to an Emacs buffer
named `*Shell Command Output*', which is displayed in another window
but not selected.  A numeric argument, as in `M-1 M-!', directs this
command to insert any output into the current buffer.  In that case,
point is left before the output and the mark is set after the output.

   `M-|' (`shell-command-on-region') is like `M-!' but passes the
contents of the region as input to the shell command, instead of no
input.  If a numeric argument is used to direct  output to the current
buffer, then the old region is deleted first and the output replaces it
as the contents of the region.

   Both `M-!' and `M-|' use `shell-file-name' to specify the shell to
use.  This variable is initialized based on your `SHELL' environment
variable when you start Emacs.  If the file name does not specify a
directory, the directories in the list `exec-path' are searched; this
list is initialized based on the `PATH' environment variable when you
start Emacs.  You can override either or both of these default
initializations in your `.emacs' file.

   When you use `M-!' and `M-|', Emacs has to wait until the shell
command completes.  You can quit with `C-g'; that terminates the shell

automatically generated by info2www