help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Run terminal command with output in current buffer


From: lisa-asket
Subject: Run terminal command with output in current buffer
Date: Fri, 16 Jul 2021 17:06:17 +0200 (CEST)

I have done the following, which should work.



But  `shell-command` does not seem to run.  



--------



(defun runcom ()
  "docstring"

  (interactive) 

  ;; grep -hir --exclude=\*.el --include=\*.{org,texi} -C 8 "node-gnu-fdl" .

  (let ( cmd
     (cmd-excl (read-from-minibuffer "exclude: "))
         (cmd-incl (read-from-minibuffer "include: "))
     (cmd-cnum (read-from-minibuffer "cnum: "))
     (cmd-ptrn (read-from-minibuffer "pattern: "))
     (cmd-dpth (read-from-minibuffer "dpth: ")) )

    (setq cmd-excl (concat " --exclude=\\*." cmd-excl))
    (setq cmd-incl (concat " --include=\\*." cmd-incl))
    (setq cmd-cnum (concat " -C " cmd-cnum))

    (setq cmd (concat "grep -hir" cmd-excl cmd-incl
              cmd-cnum " " cmd-ptrn " " cmd-dpth))
    (message "%s" cmd)
    (shell-command cmd (current-buffer)) ))


From: lisa-asket@perso.be
To: moasenwood@zoho.eu;
   help-gnu-emacs@gnu.org
Subject: Run terminal command with output in current buffer
Date: 16/07/2021 16:28:58 Europe/Paris

I am getting some problem reading from the minibuffer with this command 



(cmd-excl (read-from-minibuffer "exclude: "))


From: Emanuel Berg via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Run terminal command with output in current buffer
Date: 16/07/2021 15:48:52 Europe/Paris

lisa-asket wrote:

> How can I run a terminal command and insert the output in
> the current buffer?

(shell-command "ls" t)

-- 
underground experts united
https://dataswamp.org/~incal






reply via email to

[Prev in Thread] Current Thread [Next in Thread]