8

I am having an issue with one of the plugins i am running because its trying to use fish and does not like the parameters.

Is there a way i can change emacs to use bash for any plugins that use shell-command or similar functions.

(setenv "SHELL" "/bin/bash")
(setq explicit-shell-file-name "/bin/bash")

I tried the above but shell-command still seems to use fish.

2 Answers 2

11

You need to change the option shell-file-name.


(setenv "SHELL" "/bin/bash")

This doesn't work since Emacs is already running thus it's too late, Emacs initializes shell-file-name according to SHELL during startup. Something like

$ SHELL=/bin/bash emacs

should work.

(setq explicit-shell-file-name "/bin/bash")

This is for M-x shell, not M-x shell-command.

3
  • 1
    Cheers, I can work with that i was hoping there might have been a nicer solution I will wait in case anyone else knows another way, else i will accept this answer.
    – Oly
    Commented Nov 14, 2016 at 9:22
  • @Oly Don't know about your expect. Setting shell-file-name to bash is sufficient for you, I think.
    – xuchunyang
    Commented Nov 14, 2016 at 9:38
  • 2
    Cheers the correct answer is (setq shell-file-name "/bin/bash") this makes shell-command use bash instead of the default, and has fixed the plugin i am trying to use :)
    – Oly
    Commented Nov 14, 2016 at 18:12
0

You can also do:

(setenv "ESHELL" "/bin/bash")

Here's an excerpt from the implementation of shell.

...
   ;; Rain or shine, BUFFER must be current by now.
   (unless (comint-check-proc buffer)
     (let* ((prog (or explicit-shell-file-name
                      (getenv "ESHELL") shell-file-name))
            (name (file-name-nondirectory prog))
...

Here's a link to it in the emacs mirror on github

https://github.com/emacs-mirror/emacs/blob/a1abb6a85e6605c256595b8d7b885018e5421c28/lisp/shell.el#L927

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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