Skip to main content

Questions tagged [shell-command]

is for executing shell commands from Emacs (the default key binding is `M-!`). Shell output is shown in the echo area if it fits, in buffer `*Shell Command Output*` otherwise. Emacs comes with many supporting facilities for executing shell commands, including interactive execution, selective execution on a region, history cycling, directory tracking, connecting to serial ports, emulator options, and specifying remote hosts.

27 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
490 views

Shutting down computer from emacs killing gracefully emacs itself

I am using EXWM on Arch as my windows manager. Substantially my startx launches exec dbus-launch --exit-with-session emacs so I am running only emacs and living inside it. I would like to define a ...
Gabriele Bozzola's user avatar
3 votes
1 answer
300 views

Define the window location of the output of shell command

I use M-! to run the command shell-command. The output will open the buffer in a new window at the bottom. Can I configure it to appear on the right?
yuxuan's user avatar
  • 781
3 votes
0 answers
733 views

Emacs on Windows: `shell-command` hangs when process wants input

I am using Emacs on Windows 8. Some processes when run through shell-command will request interactive input, notably commands like git push (which will ask for user name and password). Sometimes I ...
kdb's user avatar
  • 1,571
2 votes
1 answer
332 views

How can I automatically rename buffers created with `async-shell-command` to the shell command that was called?

I am often opening exwm buffers by running async-shell-command but unfortunately these buffers always get named *EXWM*. It would be great if when I ran async-shell-command 'firefox the buffer that ...
Nicholas Hubbard's user avatar
2 votes
0 answers
35 views

Exec a external shell command that have external read input - ex:cookiecutter

As the examble like cookicutter, it have a read input in itself that we must type if we use it in normal terminal. $> #comment: this is normal terminal emulator $> cookiecutter $HOME/...
Kidman's user avatar
  • 31
2 votes
1 answer
872 views

Print shell-command output to STDOUT?

Is there an equivalent of C's system(char*) or Python's os.system(string) for emacs --script? I want to use Emacs for shell-scripting purposes. However, I cannot find a function that allows running an ...
kdb's user avatar
  • 1,571
1 vote
0 answers
39 views

shell-command changing the behavior of my program

Consider the following C code: #include <stdio.h> #include <unistd.h> int main() { printf("PID: %d\n", getpid()); fork(); } This should output the PID of the process and ...
rahmu's user avatar
  • 111
1 vote
0 answers
25 views

Locally shell-process remote files?

I'm using https://github.com/schspa/dtb-mode to transparently decompile binary dtb files; dtb-mode does this by running dtc on the underlying file (which, AFAICT, doesn't accept input from stdin). ...
Sebastian Sturm's user avatar
1 vote
0 answers
54 views

Allow user to interact with subprocess

I would like to call a subprocess, and that subprocess has some interactive behavior. Thus, I would emacs to parse the output of the subprocess, ask the user for input, and then hand that input back ...
quackrabbit's user avatar
1 vote
0 answers
175 views

In emacs term-mode (not shell-mode), how can we edit a command just like we type C-x C-e in real terminal

In real terminal, if we type C-x C-e, we can edit a typed command using an editor. Could have similar function in emacs term-mode? After typing a shortcut, I would like to edit the current command ...
AhLeung's user avatar
  • 1,083
1 vote
0 answers
157 views

Problem execution scope org-babel in shell on windows 8

I just discovered that in order to run a sequence of shell commands under the same scope (same shell session) I have to add a hash at the end of the line. Example When I try to run the following ...
Juan's user avatar
  • 11
1 vote
0 answers
81 views

Display dropbox status

I would like my emacs to call dropbox status every 30 seconds and display whether Dropbox is up-to-date at the bottom of the buffer (where info such as the line-number and file name is). How could ...
jackkamm's user avatar
  • 111
1 vote
0 answers
55 views

How can I pass an argument (via highlighting) to a shell command while also passing the filename as an argument?

Im attempting to run a perl script on a buffer which will rearrange/edit the contents. I want to highlight a string and let that be my input as well as the buffer or file. Currently I can come close. ...
Derek Thomas's user avatar
0 votes
0 answers
51 views

Add a shell command to dired mode

I want to add a command to dired-mode, which executes a shell command on the highlighted file. For example, from Bash, I can run qvm-copy {FILENAME}. I would like to replicate this behavior, but from ...
ch-pub's user avatar
  • 220
0 votes
1 answer
81 views

"Aliasing" `ls` to `gls`

gls not ls: My system has two forms of ls, the standard "old school" version of ls, and GNU ls which is available as gls. In my shell, I simply created an alias to use gls, but I have not ...
Anoduck's user avatar
0 votes
0 answers
101 views

Executing commands from a buffer

Following instructions here:- https://www.emacswiki.org/emacs/ExecuteExternalCommand which says: Using the whole buffer If you are programming using an interpreted language, such as Perl or Python, ...
balanga's user avatar
  • 135
0 votes
0 answers
33 views

How can I enable shell-command in Termux build of Emacs?

Installation of emacs on termux (from f-droid) does not support shell-command. Does this require a port of shell access code to termux, or is it some sort of option that I would be able to activate?
jim theriot's user avatar
0 votes
0 answers
17 views

Why doesn't Imagemagick's import utility work when called from async-shell-command, but works as expected when called from vterm?

I'm trying to get screenshots working in EXWM. From vterm if I issue the command import png:- | xclip -selection clipboard -t image/png this turns my mouse cursor into a crosshair, prompting me for a ...
Dargscisyhp's user avatar
0 votes
0 answers
72 views

`shell-command` repeats my input characters multiple times

whenever I run this command (shell-command "chatgpt install &") my input characters gets repeated like this: 1> hi hi Hello! How can I assist you today? 2> hi again hhii ...
ntriisii's user avatar
0 votes
0 answers
38 views

Best way to get man to open in emacs by default

I currently have: man () { emacs -nw --eval "(man \"$1\")"; } in my .zshrc. However, this has the problem of not working with something like read(2) or command-line arguments to ...
user129393192's user avatar
0 votes
1 answer
103 views

How can I disable helm file completion for interactive shell command?

I have turned on (helm-mode 1) and selectively turned it off for find-file for default emacs behavior, which I prefer. I would also like to restore non-helm behavior for file completion when invoking ...
Dov Grobgeld's user avatar
0 votes
0 answers
75 views

start-process permissions in Windows

I can open an HTML file using shell command: M-! start file.html, but when I try to write an elisp function which includes the line (some of these arguments are actually variables but I've written out ...
hatmatrix's user avatar
  • 1,096
0 votes
1 answer
794 views

Pseudo-terminal will not be allocated because stdin is not a terminal. ssh_askpass: exec(/usr/libexec/openssh/ssh-askpass): No such file or directory

CentOS 7, Emacs 27.1 Here content of file myFile.sh: ssh [email protected] So when in vterm mode I use this: ./myFile.sh then I success connect to the remote machine (ip = 10.111.11.111) by ...
a_subscriber's user avatar
  • 4,174
0 votes
0 answers
448 views

Execute a command from a buffer

Say, you create a new buffer (Fundamental), type a shell command and want it executed. Like you can do in a *scratch* buffer with lisp code (C-x C-e). Or you have a text file, that has text ...
x-yuri's user avatar
  • 291
0 votes
0 answers
19 views

reference mutltiple selections or registers for shell-command-on-region

C-u M-| is wonderful for things like running sort a region. But I've wandered into an interesting place. I wan to run join or comm on two regions in a buffer. # region 1 a 1 b 2 z 26 # region 2 a ...
Will's user avatar
  • 203
0 votes
1 answer
140 views

Best way to test output sent to a buffer

I'm writing an emacs package for Pipenv and the spike solution uses sync shell calls, which is not desirable for general usage. I'm now changing calls to be async (make-process) and for output to go ...
pwalsh's user avatar
  • 245
0 votes
1 answer
304 views

Pulseaudio and `shell-command` calls in Emacs

I'm trying to execute shell-commands in emacs which play sounds or otherwise involve audio output, but I'm not having much luck. When I execute: (shell-command (concat "espeak -v mb-en1 -k5 -s150 " ...
emacsomancer's user avatar
  • 1,041