Function: dired-do-async-shell-command

dired-do-async-shell-command is an autoloaded, interactive and byte-compiled function defined in dired-aux.el.gz.

Signature

(dired-do-async-shell-command COMMAND &optional ARG FILE-LIST)

Documentation

Run a shell command COMMAND on the marked files asynchronously.

Like dired-do-shell-command, but adds & at the end of COMMAND to execute it asynchronously.

When operating on multiple files, asynchronous commands are executed in the background on each file in parallel. In shell syntax this means separating the individual commands with &. However, when COMMAND ends in ; or ;& then commands are executed in the background on each file sequentially waiting for each command to terminate before running the next command. In shell syntax this means separating the individual commands with ;.

The output appears in the buffer named by shell-command-buffer-name-async.

Probably introduced at or before Emacs version 23.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
;;;###autoload
(defun dired-do-async-shell-command (command &optional arg file-list)
  "Run a shell command COMMAND on the marked files asynchronously.

Like `dired-do-shell-command', but adds `&' at the end of COMMAND
to execute it asynchronously.

When operating on multiple files, asynchronous commands
are executed in the background on each file in parallel.
In shell syntax this means separating the individual commands
with `&'.  However, when COMMAND ends in `;' or `;&' then commands
are executed in the background on each file sequentially waiting
for each command to terminate before running the next command.
In shell syntax this means separating the individual commands with `;'.

The output appears in the buffer named by `shell-command-buffer-name-async'."
  (interactive
   (let ((files (dired-get-marked-files t current-prefix-arg nil nil t)))
     (list
      ;; Want to give feedback whether this file or marked files are used:
      (dired-read-shell-command "& on %s: " current-prefix-arg files)
      current-prefix-arg
      files)))
  (unless (string-match-p "&[ \t]*\\'" command)
    (setq command (concat command " &")))
  (dired-do-shell-command command arg file-list))