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 13:30:01 +0200 (CEST)

I have progressed as follows, with the intention that I can run the following 
command



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





--------



(defun runcom ()
  "docstring"

  (interactive) 

  ;; grep -hir --exclude=\*.el --include=\*.{org,texi} -C 8 "node-gnu-fdl" .
  
  (cmd-excl (read-from-minibuffer "exclude: "))
  (setq cmd-excl (concat " -C --exclude=\*." cmd-excl))
  
  (cmd-incl (read-from-minibuffer "include: "))
  (setq cmd-incl (concat " -C --include=\*." cmd-incl))

  (cmd-cnum (read-from-minibuffer "cnum: "))
  (setq cmd-cnum (concat " -C " cmd-cnum))
  
  (cmd-ptrn (read-from-minibuffer "pattern: "))

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

)




From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Run terminal command with output in current buffer
Date: 16/07/2021 09:07:21 Europe/Paris

> From: lisa-asket@perso.be
> Date: Fri, 16 Jul 2021 08:43:27 +0200 (CEST)
> 
> How can I run a terminal command and insert the output in the current buffer?

"C-u M-! the command RET"

See the doc string of M-! for details.




reply via email to

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