I have the following two lines of code in my init.el file:

(setq shell-file-name "bash")
(setq shell-command-switch "-ic")

I tried executing the following script to get a list of executables using the shell script dmenu_path.

(defun dmenu-path-out ()
  (shell-command-to-string "dmenu_path"))

I see the following error:

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

How can I prevent bash from returning that error when using shell-command?


The -i flag requests that Bash run in interactive mode, which requires a terminal. The solution is to leave the shell-command-switch variable at its default value, which is just -c.

If you really need to run Bash in interactive mode, you will need to run it in a pseudo-terminal, by using start-file-process with process-connection-type bound to t.

  • This didn't work for me. – Didier A. Aug 18 '18 at 9:07
  • It works for me. As an example, this command launches gnome-terminal, runs echo and leaves the Bash session running and ready to take new commands: (start-file-process-shell-command "peekaboo" "*Messages*" "gnome-terminal -- bash -c 'echo Peekaboo!; bash'"); any output from the Elisp command is sent to the *Messages* buffer. Note that I used start-file-process-shell-command instead of start-file-process, so I don't need to give the path to shell programs. – Arch Stanton Mar 25 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.